Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was 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
@DaDeather

Description

@DaDeather
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions