-
Notifications
You must be signed in to change notification settings - Fork 2
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
Assert the proper status code for PUT #38
Conversation
c0f7e17
to
889ec7d
Compare
There are more instances in the code where this is a problem, will fix all of them eventually. EDIT: Done |
See https://tools.ietf.org/html/rfc7231#section-4.3.4 Money quote: If the target resource does not have a current representation and the PUT successfully creates one, then the origin server MUST inform the user agent by sending a 201 (Created) response. If the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server MUST send either a 200 (OK) or a 204 (No Content) response to indicate successful completion of the request.
889ec7d
to
e642b37
Compare
It's a MUST in the spec, but in real-world implementations of both servers and clients it's basically treated as a SHOULD and most programs send and accept 200s. If the storage backend doesn't inform your middleware, then it can be expensive to look it up first. How about making it a warning instead of a failure (similar to how we treat content types)? |
I agree that nobody would care about this part. Warning sounds fine, but then I'd propose that warnings are fatal by default as well. |
I.e. you specifically need to opt out of a spec violation instead of opt in. Perhaps the user should be able to selectively skip tests and warnings. |
Maybe expressive override keys in the config file? |
Yes. I'd say it's only useful in combination with #33 because otherwise errors might pop up in subsequent tests, which you'll also have to skip. |
Closing this for now. |
See https://tools.ietf.org/html/rfc7231#section-4.3.4
Money quote: