Skip to content
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

Merged
merged 15 commits into from
May 29, 2024
Merged

Conversation

srt32
Copy link
Member

@srt32 srt32 commented May 24, 2024

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.

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.
src/auto-check-element.ts Outdated Show resolved Hide resolved
src/auto-check-element.ts Outdated Show resolved Hide resolved
src/auto-check-element.ts Outdated Show resolved Hide resolved
Copy link
Member

@keithamus keithamus left a 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

@srt32 srt32 marked this pull request as ready for review May 28, 2024 15:22
@srt32 srt32 requested a review from a team as a code owner May 28, 2024 15:22
@srt32 srt32 marked this pull request as draft May 28, 2024 15:22
@srt32 srt32 marked this pull request as ready for review May 28, 2024 17:35
@srt32
Copy link
Member Author

srt32 commented May 28, 2024

I've added a spec as well as some other tweaks (that are less elegant than I would like).

@srt32 srt32 requested a review from keithamus May 29, 2024 16:34
@@ -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'
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT of 059dde3?

@srt32 srt32 merged commit 840ca05 into main May 29, 2024
1 check passed
@srt32 srt32 deleted the srt32-support-other-http-methods branch May 29, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants