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

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

cyberwolf commented Nov 14, 2012

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.

Member

Maks3w commented Nov 14, 2012

Can you add a test case?

Contributor

cyberwolf commented Nov 30, 2012

Ok will give it a try :)

Contributor

cyberwolf commented Nov 30, 2012

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

[#2962] add missing import
- Added import for SetCookie HTTP header

weierophinney added a commit that referenced this pull request Dec 10, 2012

Merge branch 'hotfix/2962' into develop
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

[zendframework/zendframework#2962] add missing import
- 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

Merge branch 'hotfix/2962' into develop
Forward port zendframework/zendframework#2962

Conflicts:
	tests/ZendTest/Http/ClientTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment