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

Skip to content

[HttpClient] Missing response content in profiler after adding retryable http client #38631

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

Closed
BoShurik opened this issue Oct 19, 2020 · 6 comments · Fixed by #38633
Closed

Comments

@BoShurik
Copy link
Contributor

Symfony version(s) affected: 5.2.0-BETA2

Description
Before

Request
[▼
  "query" => [▶]
]

Response
[▼
  "info" => [▶]
  "url" => "..."
  "response_headers" => [▶]
  "response_json" => [▶]
]

After

Response
[▼
  "buffer" => false
  "query" => [▶]
]

Response
[▼
  "info" => [▶]
  "url" => "..."
  "response_headers" => [▶]
]

Is this a bug or expected behaviour?

@Nyholm
Copy link
Member

Nyholm commented Oct 19, 2020

Thank you for trying out the beta release. <3

Ping @jderusse, Do you know on the top of your head? or should I try to investigate?

@jderusse
Copy link
Member

I'm on it @Nyholm

@jderusse
Copy link
Member

Issue is:

  1. RetryableHttpClient -> decorates TracableHttpClient -> decorate CurlClient.
  2. RetryableHttpClient use AsyncResponse.
  3. Body reported in Profiler is buffered when user call $response->getContent/toArray

When user call AsyncResponse::getContent() it don't call decoratedReponse->getContent(), it steams the response instead.

The TracableResponse::getContent method is never called, thus never bufferise the content and never report it in the Profiler.

PR opened #38633

@Nyholm
Copy link
Member

Nyholm commented Oct 19, 2020

Lovely. Thank you.

@BoShurik Does this patch work for you?

@BoShurik
Copy link
Contributor Author

@Nyholm Is there easy way to test PR on existing project? I tried a patch but it's for symfony/symfony not symfony/http-client

@Nyholm
Copy link
Member

Nyholm commented Oct 20, 2020

The simplest way is just to copy the few lines from the PR.

If it was a larger PR or your really wanted to do the "proper" way. Then you need to clone symfony/symfony, pull the fork and then use the link command.
See the docs for more details.

@fabpot fabpot closed this as completed Oct 21, 2020
fabpot added a commit that referenced this issue Oct 21, 2020
… (jderusse)

This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[HttpClient] Fix decorating progress info in AsyncResponse

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38631
| License       | MIT
| Doc PR        | /

This PR reverts #38413, and send AsyncContext to onProgress callback.

Commits
-------

e325f51 [HttpClient] Fix decorating progress info in AsyncResponse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants