Skip to content

Commit 22e7123

Browse files
committed
Moved and extended test case
1 parent bb57ac8 commit 22e7123

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

src/Symfony/Component/HttpClient/NativeHttpClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function request(string $method, string $url, array $options = []): Respo
9696
'response_headers' => [],
9797
'url' => $url,
9898
'error' => null,
99+
'canceled' => false,
99100
'http_method' => $method,
100101
'http_code' => 0,
101102
'redirect_count' => 0,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ trait ResponseTrait
4949
private $content;
5050

5151
private $info = [
52-
'response_headers' => [],
53-
'http_code' => 0,
52+
'canceled' => false,
5453
'error' => null,
54+
'http_code' => 0,
55+
'response_headers' => [],
5556
];
5657

5758
/** @var resource */

src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ public function testReentrantBufferCallback()
114114
$response->getContent();
115115
}
116116

117-
public function testInfoOnCanceledResponse()
118-
{
119-
$client = $this->getHttpClient(__FUNCTION__);
120-
121-
$response = $client->request('GET', 'http://localhost:8057');
122-
$response->cancel();
123-
124-
$this->assertTrue($response->getInfo('canceled'));
125-
}
126-
127117
public function testThrowingBufferCallback()
128118
{
129119
$client = $this->getHttpClient(__FUNCTION__);

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,17 @@ public function testCancel()
515515
$response->getHeaders();
516516
}
517517

518+
public function testInfoOnCanceledResponse()
519+
{
520+
$client = $this->getHttpClient(__FUNCTION__);
521+
522+
$response = $client->request('GET', 'http://localhost:8057/timeout-header');
523+
524+
$this->assertFalse($response->getInfo('canceled'));
525+
$response->cancel();
526+
$this->assertTrue($response->getInfo('canceled'));
527+
}
528+
518529
public function testCancelInStream()
519530
{
520531
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy