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

Skip to content

[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response #37966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

The current message is TypeError: Argument 4 passed to Symfony\Component\HttpClient\Response\MockResponse::fromRequest() must implement interface Symfony\Contracts\HttpClient\ResponseInterface, instance of Generator given.

I lost some time with this because I was passing a callable that returns a \Generator instead of passing the resulting \Generator directly. We could support that case but I guess with the added exception message, it is clear we don't support it at all.

@carsonbot carsonbot added Status: Needs Review HttpClient DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels Aug 27, 2020
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Aug 27, 2020
@fancyweb fancyweb force-pushed the http-client-mock-client-response-factory-throw branch from fef0c62 to c11482f Compare August 28, 2020 08:03
@fancyweb fancyweb force-pushed the http-client-mock-client-response-factory-throw branch from c11482f to 564dce3 Compare August 28, 2020 12:31
@fabpot
Copy link
Member

fabpot commented Aug 30, 2020

Thank you @fancyweb.

@fabpot fabpot merged commit 4d6ea77 into symfony:4.4 Aug 30, 2020
This was referenced Aug 31, 2020
@fancyweb fancyweb deleted the http-client-mock-client-response-factory-throw branch August 31, 2020 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpClient Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants