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

Passed headers are upper cased on first character by default #160

Closed
2 tasks done
DaDeather opened this issue Nov 13, 2018 · 0 comments
Closed
2 tasks done

Passed headers are upper cased on first character by default #160

DaDeather opened this issue Nov 13, 2018 · 0 comments

Comments

@DaDeather
Copy link
Contributor

  • I was not able to find an open or closed issue matching what I'm seeing.
  • This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

The passed headers are being made ucfirst() by default. Which is unnecessary according to HTTP 1.1 (https://www.w3.org/Protocols/rfc2616/rfc2616.html and which was not changed in https://tools.ietf.org/html/rfc7230#appendix-A.2).

See:
https://github.com/zendframework/zend-http/blob/master/src/Client/Adapter/Socket.php#L384

We are facing an issue were an API provider is checking for a case sensitive x- header (which of course is not HTTP 1.1 compliant).

Code to reproduce the issue

$config = [
    'adapter' => 'Zend\Http\Client\Adapter\Socket',
    'ssltransport' => 'tls'
];
$client = new Client('http://httpbin.org', $config);
$request = new Request();
$request->setUri('http://httpbin.org/get');
$request->setHeaders(Headers::fromString('x-my-test: myTest'));
$response = $client->send($request);

Expected results

The header parameter should have been the way it has been given:
x-my-test: myTest

Actual results

The header is being upper cased for the first char resulting in:
X-my-test: myTest

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 a pull request may close this issue.

1 participant