Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Fixed bug with reading access token from authorization header #12

Merged
merged 2 commits into from
Jan 11, 2013

Conversation

naasir
Copy link
Contributor

@naasir naasir commented Jan 10, 2013

This bug was preventing clients from specifying the access token in the HTTP authorization header (vs. specifying it as a query param).

@micahlmartin
Copy link
Owner

What exactly is the nature of the bug? I'm not sure I follow.

@naasir
Copy link
Contributor Author

naasir commented Jan 11, 2013

Hey Micah,

The IRequest.Headers property has type IDictionary<string, IList> (see IRequest:11).
So this call: _request.Headers.SafeGet(HeaderType.Authorization) returns an IList not a single string. When you then concatenate that with "" (which does an implicit conversion), you get a string that describes the type, instead of the value, which is what we're after.

As for replacing "" with string.empty, that was just a resharper suggestion.

@micahlmartin
Copy link
Owner

I see. That makes sense. However I think the call to First() should be FirstOrDefault() because if the list is empty it will throw an exception.

@naasir
Copy link
Contributor Author

naasir commented Jan 11, 2013

Ah, good call. Fixed.

@micahlmartin
Copy link
Owner

Nice job! Thanks for fixing!

micahlmartin pushed a commit that referenced this pull request Jan 11, 2013
Fixed bug with reading access token from authorization header
@micahlmartin micahlmartin merged commit 7f8ef60 into micahlmartin:master Jan 11, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants