-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversation
{ | ||
get | ||
{ | ||
var header = Headers.Keys.FirstOrDefault(h => h.ToLowerInvariant() == "content-type"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h => String.Equals(h, "Content-Type", StringComparison.OrdinalIgnoreCase)
HTTP header fields are case sensitive, so there should be no need to do any case magic. Just grab |
ed91d21
to
015e055
Compare
Might be better to use a case insensitive dictionary for the headers. But we might break al sorts of apps sneakily relying on case-sensitive headers. |
Needs to be ordinal ignore case |
015e055
to
3bef79c
Compare
@jchannon Sorry 😄 |
Response response = value; | ||
|
||
// When | ||
response.Headers.Add("content-type", "application/json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: I would wEiRDcaSe the "content-type"
string to demonstrate that case is ignored
3bef79c
to
cb5c8ba
Compare
Looks like the response headers haven't received the same love as the request headers. Those are kept in a case-insensitive dictionary. See |
@khellang soundslike a plan. Not worried about breaking stuff? |
I don't mind. I'd actually love to see a |
I was feeling a bit of scope creep going on 😄 |
@khellang this looks a lot cleaner |
Looks good now 👍 |
Overwrite Content-Type from headers
Should overwrite the content-type from the headers when it's set there. Don't you think?