-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support alternative HTTP methods #72
Conversation
This change proposed supporting the use of alternative HTTP methods. For example, now a user can define `http-method=GET` and then component will issue a `GET` request using encoded query params instead. All values other than POST will use this new approach. The default remains POST.
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
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.
LGTM 👍. Some tests would be handy though
I've added a spec as well as some other tweaks (that are less elegant than I would like). |
src/auto-check-element.ts
Outdated
@@ -176,6 +176,10 @@ export class AutoCheckElement extends HTMLElement { | |||
set csrfField(value: string) { | |||
this.setAttribute('csrf-field', value) | |||
} | |||
|
|||
get httpMethod(): string { | |||
return this.getAttribute('http-method') || 'POST' |
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.
This should probably just return allowed values, eg just GET or POST. Otherwise this allows for arbotrary verbs. Might lead to undesired behaviour.
We can ship this and bugfix later if time is of the essence.
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.
WDYT of 059dde3?
This change proposed supporting the use of alternative HTTP methods.
For example, now a user can define
http-method=GET
and then component will issue aGET
request using encoded query params instead. All values other than POST will use this new approach. The default remains POST.