-
-
Notifications
You must be signed in to change notification settings - Fork 127
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 ability to handle correctly OPTIONS
and HEAD
requests
#578
Merged
josephmancuso
merged 85 commits into
MasoniteFramework:4.0
from
girardinsamuel:feat/options
May 17, 2022
Merged
Add ability to handle correctly OPTIONS
and HEAD
requests
#578
josephmancuso
merged 85 commits into
MasoniteFramework:4.0
from
girardinsamuel:feat/options
May 17, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 tasks
Add database validation rules `exists_in_db` and `unique_in_db`
…/552 Added feature to share individual input validation errors in session
@josephmancuso can you take a look at this? This PR is required for the CORS feature 😉. |
…werkzeug Switch to `werkzeug` development server
…re/610 fixed jwt tokens
…el/masonite into girardinsamuel-feat/add-throttling
…-throttling Add Rate Limiting feature
…re/614 added dd to views
…re/613 Feature/613 - Added Route Views
…nite into girardinsamuel-feat/options
josephmancuso
approved these changes
May 5, 2022
code review good. Just want to test this manually before merging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds:
OPTIONS request handling
Before, if a route with
OPTIONS
had not been defined, a request to an existing route with OPTIONS method was returning a 404 Not Found. Now, it's returning a 204 No Content response withAllow
headers containing the allowed request methods for this route.(ref https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS#identifying_allowed_request_methods)
Method Not Allowed handling
Before if a route was accessed with wrong request method, it was returning a 404 Not Found. Now if the route exists but accessed with wrong methods, it will return a 405 Method Not Allowed exception with error message containing the allowed request methods for this route.
HEAD request handling
Before, if a route with
HEAD
had not been defined, a request to an existing route with HEAD method was returning a 404 Not Found. Now, it's returning a 204 No Content response with the headers that would have been sent if the request had been made withGET
method.(ref https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD)
In addition, when defining a
GET
route, Masonite will automatically add aHEAD
route for it.Here is a summary with CURL commands against a Masonite app:
For this, two small features have been added:
withHeaders
to response to add headers as a dict easily, asheader()
was one header by one and was not returning response class