add support for other HTTP methods #293
Closed
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.
Prompted by the recent updates to the XProc 3.0 issue about HTTP methods, where I argued that an XProc processor should support any method, I finally got around to the refactoring we discussed a while back, when I had quickly patched in HTTP
PATCH
.I've added two inner classes to implement HTTP requests with a body, and without a body, which are used when the
c:request/@method
is not one of the specifically-handled methods likeGET
andPUT
. If you supply a body, you get one of those classes; if you don't supply a body, you get the other.I "flipped" the sanity check which used to ensure that you didn't supply a body along with a method which doesn't call for a body, so that it uses an "open world" assumption, and rejects only the cases which it knows are definitely in error, and otherwise (if the method is not known) it assumes that you know what you're doing.
The additional tests make HTTP
OPTIONS
requests, both with and without a body, and check that the server responds with200
OK to both.