Closed gabrielgiordan closed 2 years ago
Unfortunately both HTTP request and response headers can be duplicated. So even if a browser is not sending multiple, an API or anyone can send duplicate and therefore plugs needs to deal with such. Thank you.
Instead of iterating through all values, iterates only until the header is found.
When more than one header with same key is sent, like
Accept-Language: en_US
,Accept-Language: pt_BR
,Accept-Language: en_GB
, thereq_header
comes as{"accept-language", "en_US, pt_BR, en_GB"}
. So, returning the first found value is fine.By the way, personally I preferred to return the value itself, but to be backwards compatible, I'm returning it wrapped on a list.