-
Notifications
You must be signed in to change notification settings - Fork 12
Uppercase the http method #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ export class HttpContext { | |
} | ||
|
||
const { headers, header, url: rawUrl, method: m } = req.json(); | ||
const method = m ?? 'GET'; | ||
const method = m?.toUpperCase() ?? 'GET'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, TIL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it works for methods too? at least i've been doing this in other places. the compiler didn't complain but also i think it's an function z(s?: string | null) {
console.log(s?.toUpperCase() || "GET")
}
z() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. becomes: "use strict";
function z(s) {
console.log((s === null || s === void 0 ? void 0 : s.toUpperCase()) || "GET");
}
z(); |
||
const url = new URL(rawUrl); | ||
|
||
const isAllowed = this.allowedHosts.some((allowedHost) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i noticed there are explicit conditional checks for uppercase below. is there somewhere else this could be getting set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope – I think this code used to assume that the pdk will always call with uppercased HTTP verbs.