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

Allow Accept-Encoding header to be set explicitly by http request #2962

Closed
wants to merge 2 commits into from
Closed

Allow Accept-Encoding header to be set explicitly by http request #2962

wants to merge 2 commits into from

Conversation

cyberwolf
Copy link
Contributor

Currently it does not seem possible to override the Accept-Encoding header, I think because of some code in Zend\Http\Client::prepareHeaders that uses an undefined $headers member variable while it should check if the header is already explicitly set in the request.

@Maks3w
Copy link
Member

Maks3w commented Nov 14, 2012

Can you add a test case?

@cyberwolf
Copy link
Contributor Author

Ok will give it a try :)

@cyberwolf
Copy link
Contributor Author

The actual cause of the problem was that Zend\Http\Client::prepareHeaders() used different case for the header name, Accept-encoding vs. Accept-Encoding. When merging the headers from the request object within $headers later on, instead of replacing the default one there would end up 2 Accept-Encoding headers in $headers, one keyed "Accept-encoding" and another one keyed "Accept-Encoding".

I fixed the naming and added a test as well.

weierophinney added a commit that referenced this pull request Dec 10, 2012
- Added import for SetCookie HTTP header
weierophinney added a commit that referenced this pull request Dec 10, 2012
Forward port #2962

Conflicts:
	tests/ZendTest/Http/ClientTest.php
@ghost ghost assigned weierophinney Dec 10, 2012
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
- Added import for SetCookie HTTP header
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#2962

Conflicts:
	tests/ZendTest/Http/ClientTest.php
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 this pull request may close these issues.

4 participants