Added Debug tracing and response->raw_headers #17
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.
Hi,
I added two features, thank you for considering them for integration.
More info below.
Regards,
Larry Kluger
Debug Tracing
When working with a new protocol, sometimes you need to see exactly what is being sent and received "on the wire." This type of "peeking" is a common development tool for network protocols. Debug trace is enabled when he calling program defines a constant
UNIREST_TRACE
. See the bottom of the updated Readme.response->raw_headers
As I developed my app, which is implementing OAuth with SharePoint Online, I found that the existing
response->headers
was not sufficient since Microsoft returns two headers with the same key (the same name). Since response->headers is a hash, the second instance of the header was overwriting the first one. There was no way for me to access the first value of the header. So I added theraw_headers
property.It turns out that having multiple headers with the same name is legal. See the HTTP specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 But is certainly unusual. I think adding
raw_headers
is a light-weight way to enable people to deal with this corner-case.