Skip to content

possibility to set urlencode to false #1

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

Conversation

mbarataPHP
Copy link

The feature offers a choice on encoding query

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets  
License MIT
Doc PR  

example:

$httpClient = HttpClient::create();

$response = $httpClient->request('GET', 'http://example.com', [
    'query'=>[
        'key_1'=>['value'=>'example1,example2', 'urldecode'=>false],
        'key_2'=>'normal'
    ]
]);

@symfony-bot
Copy link

symfony-bot bot commented Aug 4, 2019

Thanks for your pull request! We love contributions.

However, this repository is what we call a "subtree split": a read-only copy of one directory of the main Symfony repository. It is used by Composer to allow developers to depend on specific Symfony components.

If you want to contribute, you should instead open a pull request on the main repository:

https://github.com/symfony/symfony

Thank you for your contribution!

PS: if you haven't already, please add tests, and beware that bug fixes should be submitted on the lowest maintained branch where they apply; only features should be submitted against the master branch.

@symfony-bot symfony-bot bot closed this Aug 4, 2019
@nicolas-grekas
Copy link
Member

But actually this would be rejected. If you need a specific encoding scheme, pass the query in the URL directly.

symfony-splitter pushed a commit that referenced this pull request Jun 9, 2022
… body for c… (Phillip Look)

This PR was merged into the 6.1 branch.

Discussion
----------

[HttpClient][WebProfilerBundle] Catch errors when encoding body for c…

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

In Symfony 6.1 a [button to copy a request as a cURL command](symfony/symfony#43931) was introduced for the profiler.

But if I post a binary file containing null characters using the curl-http-client the `HttpClientDataCollector` throws an error.
```
Warning: Uncaught ValueError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes
```

My solution is to catch the `ValueError` in this situation and to return `null` as the resulting curl command. Returning `null` seems to be the standard handling for unexpectad values in this data collector.

Commits
-------

36e6fa0935 [HttpClient][WebProfilerBundle] Catch errors when encoding body for curl command line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants