Skip to content

[HttpClient] Check status code before decoding content in TraceableResponse #38977

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
merged 1 commit into from
Nov 3, 2020

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Nov 3, 2020

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

Using toArray() on the response of a traceable client, the status code is currently checked after json decoding, which leads to JsonException being thrown instead of ClientException.
It should be the opposite, as for non-traceable responses.

@chalasr chalasr added this to the 5.1 milestone Nov 3, 2020
@chalasr chalasr force-pushed the check-status-before-decode branch from fa42935 to f84c83b Compare November 3, 2020 17:04
@chalasr chalasr force-pushed the check-status-before-decode branch from f84c83b to 59dc108 Compare November 3, 2020 17:45
@chalasr chalasr force-pushed the check-status-before-decode branch 2 times, most recently from b71b74d to 57f289a Compare November 3, 2020 19:46
@chalasr chalasr changed the title [HttpClient] Check satus code before decoding in TraceableResponse::toArray() [HttpClient] Check satus code before decoding content in TraceableResponse Nov 3, 2020
@chalasr chalasr force-pushed the check-status-before-decode branch from 57f289a to b69a995 Compare November 3, 2020 19:59
@chalasr chalasr force-pushed the check-status-before-decode branch 2 times, most recently from 3009516 to c4f2d20 Compare November 3, 2020 20:17
@nicolas-grekas nicolas-grekas changed the title [HttpClient] Check satus code before decoding content in TraceableResponse [HttpClient] Check status code before decoding content in TraceableResponse Nov 3, 2020
@chalasr chalasr force-pushed the check-status-before-decode branch 2 times, most recently from 7264c27 to 640fa70 Compare November 3, 2020 20:20
@chalasr chalasr force-pushed the check-status-before-decode branch from 640fa70 to e5595da Compare November 3, 2020 20:21
@nicolas-grekas
Copy link
Member

Good catch, thanks @chalasr.

@nicolas-grekas nicolas-grekas merged commit ff7ffdf into symfony:5.1 Nov 3, 2020
@chalasr chalasr deleted the check-status-before-decode branch November 3, 2020 20:24
@fabpot fabpot mentioned this pull request Nov 10, 2020
@fabpot fabpot mentioned this pull request Nov 29, 2020
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.

5 participants