using injected response object #5068

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@heik

heik commented Sep 3, 2013

Scenario:
Invalid HTTP codes are coming in from a webservice (in our case 497).
An exception is being thrown in HttpClient, if a constant with name STATUS_CODE_ is not existing in response entity. When setting a response object in the HTTP client containing the "missing" constant, i expected exactly this response object coming back from $client->send().

In The client the following happens:

$response = Response::fromString($response);

A new response object of type Zend\Http\Response is created on incoming response, instead of the injected one, which can be retrieved using $this->getResponse().

Current (dirty) Solution is to catch the exception and call the fromString method in the CustomResponse class containing the additional STATUS_CODE_'s.

@weierophinney

This comment has been minimized.

Show comment Hide comment
@weierophinney

weierophinney Sep 3, 2013

Member

Please add a unit test for this.

Member

weierophinney commented Sep 3, 2013

Please add a unit test for this.

@heik

This comment has been minimized.

Show comment Hide comment
@heik

heik Sep 4, 2013

oh - my bad :)
unitTest added.

heik commented Sep 4, 2013

oh - my bad :)
unitTest added.

weierophinney added a commit that referenced this pull request Sep 4, 2013

Merge pull request #5068 from heik/master
using injected response object

weierophinney added a commit that referenced this pull request Sep 4, 2013

@ghost ghost assigned weierophinney Sep 4, 2013

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

weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment