Skip to content

[HttpClient] "debug" is missing if a request failed to even start #46293

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

weaverryan
Copy link
Member

Q A
Branch? 6.1
Bug fix? yes
New feature? no
Deprecations? none
Tickets none
License MIT
Doc PR not needed

If you do something really silly - like $client->request('/foo') (where no base_uri is configured), HttpClient correctly explodes with:

Invalid URL: scheme is missing in "/SymfonyCasts/vinyl-mixes/main/mixes.json". Did you forget to add "http(s)://"?

However, in this situation, there will be no debug key in $trace. And so, currently on 6.1, instead of the above error, you see:

Warning: Undefined array key "debug"

Let me know if any changes are needed.

Thanks!

@stof
Copy link
Member

stof commented May 9, 2022

Does the template handle well the case where the data does not have a curlCommand key ?
I think it would be safer to assign it to null instead

@weaverryan
Copy link
Member Author

I think it would be safer to assign it to null instead

You're right - that is safer. Updated!

@nicolas-grekas nicolas-grekas force-pushed the data-collector-invalid-request branch from aba0de3 to 4beb320 Compare May 10, 2022 07:57
@nicolas-grekas
Copy link
Member

Thank you @weaverryan.

@nicolas-grekas nicolas-grekas merged commit 4106712 into symfony:6.1 May 10, 2022
@fabpot fabpot mentioned this pull request May 14, 2022
@weaverryan weaverryan deleted the data-collector-invalid-request branch May 16, 2022 15:10
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