Thanks to visit codestin.com
Credit goes to github.com

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

using injected response object#5068

Closed
heik wants to merge 1 commit into
zendframework:masterfrom
heik:master
Closed

using injected response object#5068
heik wants to merge 1 commit into
zendframework:masterfrom
heik:master

Conversation

@heik
Copy link
Copy Markdown

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

Please add a unit test for this.

@heik
Copy link
Copy Markdown
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