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

Skip to content

Commit 549930e

Browse files
[HttpClient] add $response->cancel()
1 parent c8f3cef commit 549930e

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

UPGRADE-4.4.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ DependencyInjection
2525
factory: ['@factory_service', method]
2626
```
2727
28+
HttpClient
29+
----------
30+
31+
* Added method `cancel()` to `ResponseInterface`
32+
2833
Messenger
2934
---------
3035

UPGRADE-5.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ FrameworkBundle
220220
* Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been removed.
221221
* Removed the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead.
222222

223+
HttpClient
224+
----------
225+
226+
* Added method `cancel()` to `ResponseInterface`
227+
223228
HttpFoundation
224229
--------------
225230

src/Symfony/Component/HttpClient/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.4.0
5+
-----
6+
7+
* added `$response->cancel()`
8+
49
4.3.0
510
-----
611

src/Symfony/Component/HttpClient/Response/ResponseTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ public function toArray(bool $throw = true): array
169169
return $content;
170170
}
171171

172+
/**
173+
* {@inheritdoc}
174+
*/
175+
public function cancel(): void
176+
{
177+
$this->info['error'] = 'Response has been canceled.';
178+
$this->close();
179+
}
180+
172181
/**
173182
* Closes the response and all its network handles.
174183
*/

src/Symfony/Contracts/HttpClient/ResponseInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public function getContent(bool $throw = true): string;
7171
*/
7272
public function toArray(bool $throw = true): array;
7373

74+
/**
75+
* Cancels the response.
76+
*/
77+
public function cancel(): void;
78+
7479
/**
7580
* Returns info coming from the transport layer.
7681
*

0 commit comments

Comments
 (0)