This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Fix RequestHeaders to proper concat repeats #87
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.
Previously RequestHeaders only provided the last instance of a repeated header.
Sadly, writing a unit test for this has proved...daunting. Python libraries from urllib's 1-3, Requests, and even httplib do not allow one to construct a header sequence like the one below (from the Web Annotation Protocol spec):
Most of these libraries use a dictionary style interface, and when given multiple values for a single header, they send them as a comma separated list (as they should! re: RFC 7230, RFC 2616, etc). However, because of that writing a test that would match the exact request seen above is...non-trivial (with the most likely suggestions being to "just use the sockets library")--which goes beyond what I care to attempt (or have time to...) in order to prove that this works. 😖
So. Instead, here's one loverly curl line for your copy/paste enjoyment:
And a simple server to test it against:
Which, if run against each other, should result in this JSON:
{ "host": "localhost:8080", "prefer": "return=representation;include=\"http://www.w3.org/ns/ldp#PreferMinimalContainer\", return=representation;include=\"http://www.w3.org/ns/ldp#PreferMinimalContainer\"", "accept": "application/ld+json; profile=\"http://www.w3.org/ns/anno.jsonld\"", "user-agent": "curl/7.41.0" }Cheers.
🎩
This change is