Support all PUT operations, error later #118
Merged
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.
When executing a bodyless
PUT
request, I would get:Clearly, the
PUT
handler is the (only) right one. The fact that it errors is because the request is invalid, and thePUT
handler is the only one who knows that.So the right error is “no body specified”, all the rest is noise. This PR brings it to:
Apart from fixing this case, I also want to draw attention to the generic mechanism.
canHandle
answers the question: “is this the right actor to be handling this?’, not: “will handling succeed?”. In this case, thePUT
actor can handle; it's just that the correct handling is to error. This means two things in particular:canHandle
methods should only check for applicability, not avoid any other errors via preconditionshandleSafe
are not guaranteed to not error; only to have that error thrown by the appropriate actorI have created #119 to ensure this is applied consistently.