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

Add support for special _method field to overwrite POST for routing #42

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

thekid
Copy link
Member

@thekid thekid commented Oct 29, 2023

HTML forms do not support anything other than GET and POST. The value sent with the _method field will be used as the HTTP request method instead of POST:

<form action="/example" method="POST">
  <input type="hidden" name="_method" value="PUT">
  <!-- Rest of form -->
</form>

This will use PUT for the server-side routing instead of POST. The method inside the request object will stay the same, though.

The name was chosen as it is a pseudo-standard amongst various frameworks.


See also:

@thekid thekid added the enhancement New feature or request label Oct 29, 2023
@thekid thekid mentioned this pull request Oct 29, 2023
@thekid thekid changed the title Add support for special _method field to overwrite HTTP method for routing Add support for special _method field to overwrite POST for routing Oct 29, 2023
@thekid thekid merged commit bfb9102 into master Oct 30, 2023
20 checks passed
@thekid thekid deleted the feature/special-method-field branch October 30, 2023 21:57
@thekid
Copy link
Member Author

thekid commented Oct 30, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant