Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Documented the new HttpClient component#11071
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| You can either handle cookies yourself using the ``Cookie`` HTTP header or use | ||
| the:doc:`BrowserKit component</components/browser_kit>` which provides this | ||
| feature and integrates seamlessly with the HttpClient component. |
zanbaldwinMar 1, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Some extra explanation is probably needed here.
I haven't seen anything insymfony/symfony#30413 relating to the BrowserKit component and the documentation for the Browser component states you must implement thedoRequest(Request $request): Response method, meaning you'd have to:
- Convert
$requestobject to$httpClient->request($method, $url, $options) - Convert
Symfony\Contracts\HttpClient\ResponseInterfacetoSymfony\Component\HttpFoundation\Response
This is non-trivial, and definitely not seamless. Perhaps an idea would be to add a static helper method (likeSymfony\Component\HttpClient\HttpOptions::fromFoundationRequest($request)) and add an example in this section.
(I know you've mentioned you're also improving BrowserKit, and may have already addressed this - if so ignore this!)
EDIT I just read Fabien's slides and saw that there's going to be a newSymfony\Component\BrowserKit\BrowserClient(HttpClientInterface $client) class. Once that's merged in it would still be a good idea to show an example of that here 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Perfectly explained! We need to wait for the merge of the BrowserKit improvements and then we'll add a mention here. Thanks.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| // defining data using a regular string | ||
| 'body' => 'raw data', | ||
| // using a closure to generate the uploaded data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we add some explanation of what the closure needs to return?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Nyholm left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I like it!
| ----------------------- | ||
| HTTP/2 is only supported when using the cURL-based transport and the libcurl | ||
| version is >= 7.36.0. If you meet these requirements, you can enable HTTP/2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is not the only requirement. Curl has to be compiled with libnghttp2 as well. Not sure if we should mention that though.
Basically, HTTP2 support is automatically enabled if your environment supports it.
Uh oh!
There was an error while loading.Please reload this page.
| }, | ||
| ]); | ||
| // Responses are lazy: this code is executed as soon as headers are received |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is not exactly true, is it?
We send the request as soon as you run the $response-getStatusCode().
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedApr 28, 2019
@javiereguiluz do you think you'll be able to move this PR forward soonish? |
javiereguiluz commentedApr 29, 2019
@nicolas-grekas as we discussed, I've finished most of this PR. I've added most of reviewer's suggestions too. The pending suggestions are the ones still visible (the fixed ones has been marked as "resolved"). This is now ready for you! Thanks. |
All suggestions have been implemented
Docs forsymfony/symfony#30413.