Okhttp: Sometimes I am getting the headers in lowercase

Created on 15 Jun 2016  路  3Comments  路  Source: square/okhttp

Hi,

I am not able to reproduce this in a consistent way, but for the same request, usually I get the Content-Range header with the first letters capitalised. But sometimes I get it in complete lowercase (content-range). There is a reason for that? Am I missing something?

Regards

Most helpful comment

For people like me it's worth noting that not only are header names case insensitive, but that more importantly (to me) HTTP2 requires that they be lowercase on the wire and the appendix of pre-indexed headers is all in lowercase. So this is something that is a necessity of HTTP2, and not just an implementation detail.

edit: typoe

All 3 comments

Header names are case-insensitive so you need to handle this. See: https://tools.ietf.org/html/rfc7230#section-3.2

This is probably a result of speaking HTTP/1.1 vs HTTP/2 since the latter favors lowercase.

@JakeWharton thanks 馃憤

For people like me it's worth noting that not only are header names case insensitive, but that more importantly (to me) HTTP2 requires that they be lowercase on the wire and the appendix of pre-indexed headers is all in lowercase. So this is something that is a necessity of HTTP2, and not just an implementation detail.

edit: typoe

Was this page helpful?
0 / 5 - 0 ratings