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

CORS: PATCH method is not allowed #109

Open
fnevgeny opened this issue Apr 3, 2018 · 4 comments
Open

CORS: PATCH method is not allowed #109

fnevgeny opened this issue Apr 3, 2018 · 4 comments

Comments

@fnevgeny
Copy link

fnevgeny commented Apr 3, 2018

I believe in corsHeaders(), in

header('Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS');

the PATCH method is missing.

Thanks for sharing the very useful code!

@tyzoid
Copy link
Collaborator

tyzoid commented Apr 4, 2018

Thanks, do you have an example API endpoint that utilizes the PATCH method?

@fnevgeny
Copy link
Author

fnevgeny commented Apr 4, 2018

PATCH is like PUT, but only for updating a part of an entity. In both cases you pass a JSON object of your choice, but while for PUT the object contains all fields, PATCH - only a subset; typically just one (e.g., changing password of a user without altering his/her name/lastname/etc)

@tyzoid
Copy link
Collaborator

tyzoid commented Apr 4, 2018

Yeah, I get what PATCH is used for, but I'm trying to figure out if it makes sense to have a slightly different way of handling this type of request, or if it makes more sense to just treat them in the same manner as a POST internally. This is tangential to the bug at hand, but related.

@fnevgeny
Copy link
Author

fnevgeny commented Apr 4, 2018

On success, POST returns 201, PATCH (like PUT) should return 204. Other than that, I don't think there should be any special treatment.

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

No branches or pull requests

2 participants