Skip to content

[HttpClient] doc how to cancel a request + upload files #11668

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
Jun 11, 2019

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jun 4, 2019

@nicolas-grekas nicolas-grekas changed the title [HttpClient] doc how to cancel a request [HttpClient] doc how to cancel a request + upload files Jun 5, 2019
nicolas-grekas referenced this pull request Jun 5, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] Documented the cancel() method

Fixes #11658.

Commits
-------

a983ece [HttpClient] Documented the cancel() method
@nicolas-grekas
Copy link
Member Author

When merging this into 4.4, don't miss removing the changes done in #11663

@javiereguiluz javiereguiluz added HttpClient Waiting Code Merge Docs for features pending to be merged labels Jun 5, 2019
fabpot added a commit to symfony/symfony that referenced this pull request Jun 5, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418 [HttpClient] add $response->cancel()
symfony-splitter pushed a commit to symfony/http-client that referenced this pull request Jun 5, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418723 [HttpClient] add $response->cancel()
symfony-splitter pushed a commit to symfony/contracts that referenced this pull request Jun 5, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418723 [HttpClient] add $response->cancel()
symfony-splitter pushed a commit to symfony/http-client-contracts that referenced this pull request Jun 5, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418723 [HttpClient] add $response->cancel()
@nicolas-grekas
Copy link
Member Author

This can merged now :)

@OskarStark OskarStark removed the Waiting Code Merge Docs for features pending to be merged label Jun 7, 2019
@nicolas-grekas nicolas-grekas force-pushed the hc++ branch 2 times, most recently from d7c3a94 to d29eb7e Compare June 7, 2019 06:32
},
]);

The exception will be wrapped in an instance of ``TransportExceptionInterface``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the symfony cloud endpoint for this PR is not bootstrapped yet :(
This belongs to the * throw an exception from a progress callback::-Part, but I am not sure if it will be rendered correct with this indention

cc @javiereguiluz

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, while merging we can reword this to remove the <ul> list and turn it into paragraphs:

To abort a request (e.g. because it didn't complete in due time, or you want to
fetch only the first bytes of the response, etc.), you can either use the ``cancel()`` 
method of ``ResponseInterface``:

   ...

Or throw an exception from a progress callback::

   ...

The exception will be wrapped in an instance of ``TransportExceptionInterface``
and will abort the request.

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Nicolas 👍

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks Nicolas.

This means there is usually nothing to configure to have the client work with
proxies, provided these env vars are properly configured.

You can still set or override these settings using the `proxy`` and ``no_proxy``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a missing opening backtick in proxy:

`proxy`` -> ``proxy``

},
]);

The exception will be wrapped in an instance of ``TransportExceptionInterface``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, while merging we can reword this to remove the <ul> list and turn it into paragraphs:

To abort a request (e.g. because it didn't complete in due time, or you want to
fetch only the first bytes of the response, etc.), you can either use the ``cancel()`` 
method of ``ResponseInterface``:

   ...

Or throw an exception from a progress callback::

   ...

The exception will be wrapped in an instance of ``TransportExceptionInterface``
and will abort the request.

@nicolas-grekas
Copy link
Member Author

Comments addressed, thank you all!

@javiereguiluz
Copy link
Member

Thank you Nicolas.

@javiereguiluz javiereguiluz merged commit b096999 into symfony:4.3 Jun 11, 2019
javiereguiluz added a commit that referenced this pull request Jun 11, 2019
…(nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] doc how to cancel a request + upload files

Fixes #11658. Needs symfony/symfony#31850

Commits
-------

b096999 [HttpClient] doc how to cancel a request + upload files
@nicolas-grekas nicolas-grekas deleted the hc++ branch June 15, 2019 21:34
sadafrangian3 pushed a commit to sadafrangian3/Dependency-Injection-http-client that referenced this pull request Nov 2, 2022
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418723 [HttpClient] add $response->cancel()
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