Skip to content

Commit 5015e23

Browse files
Merge branch '4.4'
* 4.4: [Console] Revert wrong change [HttpClient] Add a canceled state to the ResponseInterface Fix small typo in Exception message Restrict secrets management to sodium+filesystem Add secrets management Proof of concept for encrypted secrets
2 parents 70a893a + d4de123 commit 5015e23

File tree

5 files changed

+6
-0
lines changed

5 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
4.4.0
55
-----
66

7+
* added `canceled` to `ResponseInterface::getInfo()`
78
* added `HttpClient::createForBaseUri()`
89
* added `HttplugClient` with support for sync and async requests
910
* added `max_duration` option

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,

Response/MockResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public function getInfo(string $type = null)
8484
*/
8585
public function cancel(): void
8686
{
87+
$this->info['canceled'] = true;
8788
$this->info['error'] = 'Response has been canceled.';
8889
$this->body = null;
8990
}

Response/ResponseTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ trait ResponseTrait
5252
'response_headers' => [],
5353
'http_code' => 0,
5454
'error' => null,
55+
'canceled' => false,
5556
];
5657

5758
/** @var resource */
@@ -178,6 +179,7 @@ public function toArray(bool $throw = true): array
178179
*/
179180
public function cancel(): void
180181
{
182+
$this->info['canceled'] = true;
181183
$this->info['error'] = 'Response has been canceled.';
182184
$this->close();
183185
}

Tests/MockHttpClientTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface
105105
case 'testOnProgressError':
106106
case 'testReentrantBufferCallback':
107107
case 'testThrowingBufferCallback':
108+
case 'testInfoOnCanceledResponse':
108109
$responses[] = new MockResponse($body, ['response_headers' => $headers]);
109110
break;
110111

0 commit comments

Comments
 (0)