Skip to content

Conversation

@fancyweb
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? -
Tickets #49796 (review)
License MIT
Doc PR -

I think it's possible to return the same reference with this strategy. WDYT?

@nicolas-grekas
Copy link
Member

Interesting yes. Is the failure on AmazonSqs related?

@stof
Copy link
Member

stof commented Mar 30, 2023

wouldn't this break if the client does 2 requests ?

@fancyweb
Copy link
Contributor Author

Is the failure on AmazonSqs related?

Yes, it's related. The problem is that MockResponse passed as a response factory to MockHttpClient with status code >= 300 now throws on destruct because they have an initializer 😞

wouldn't this break if the client does 2 requests ?

Do you mean providing one MockResponse to MockHttpClient and calling ->request() 2 times?

@stof
Copy link
Member

stof commented Mar 31, 2023

@fancyweb yes

@fancyweb
Copy link
Contributor Author

This case is already not working, it throws The response factory iterator passed to MockHttpClient is empty. on the second request. This message should probably be improved.

@fancyweb fancyweb closed this Apr 17, 2023
nicolas-grekas added a commit that referenced this pull request Apr 19, 2023
…ancyweb)

This PR was merged into the 6.3 branch.

Discussion
----------

[HttpClient] Improve MockHttpClient exception message

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #49874 (comment)
| License       | MIT
| Doc PR        | -

When using `MockHttpClient`, if there are more requests done on the client than the passed available responses, the exception message is misleading.

~Targeting 5.4 since it only changes the exception message 😅~

Commits
-------

bd5a4ca [HttpClient] Improve MockHttpClient exception message
symfony-splitter pushed a commit to symfony/http-client that referenced this pull request Apr 19, 2023
…ancyweb)

This PR was merged into the 6.3 branch.

Discussion
----------

[HttpClient] Improve MockHttpClient exception message

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony/symfony#49874 (comment)
| License       | MIT
| Doc PR        | -

When using `MockHttpClient`, if there are more requests done on the client than the passed available responses, the exception message is misleading.

~Targeting 5.4 since it only changes the exception message 😅~

Commits
-------

bd5a4caef4 [HttpClient] Improve MockHttpClient exception message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants