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

using injected response object #5068

Closed
wants to merge 1 commit into from
Closed

Conversation

heik
Copy link

@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
Copy link
Member

Please add a unit test for this.

@heik
Copy link
Author

heik commented Sep 4, 2013

oh - my bad :)
unitTest added.

weierophinney added a commit that referenced this pull request Sep 4, 2013
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 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.

2 participants