module-rest icon indicating copy to clipboard operation
module-rest copied to clipboard

Http custom headers problem

Open sobradovic opened this issue 10 years ago • 3 comments

Custom headers have been capitalized. When I send my custom header in order to testing Rest service, for example: BOOK-ALL, it will be converted to Book-All, so my rest service receives the wrong header. Custom header should not be changed.

sobradovic avatar Mar 25 '15 15:03 sobradovic

REST module converts headers to all capitals and with underscores, e.g. BOOK-ALL is converted to HTTP_BOOK_ALL

https://github.com/Codeception/Codeception/blob/b071d6a47af9cebc306f1471de874ad2cf097671/src/Codeception/Module/REST.php#L360

Conversion to ucfirst style is performed by Guzzle connector:

https://github.com/Codeception/Codeception/blob/cdc3569fedb017eea204b40eae0c82cf726e0107/src/Codeception/Lib/Connector/Guzzle.php#L210

I copied extractHeaders method from Guzzle to ZF1 and ZF2 connectors, so they will have the same behaviour, but I don't know if any of those conversions are necessary.

Naktibalda avatar May 24 '15 15:05 Naktibalda

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

SamMousa avatar Oct 28 '20 13:10 SamMousa

Header names are case insensitive so your code should not rely on any specific casing

SamMousa avatar Oct 28 '20 13:10 SamMousa