Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65609d8

Browse files
[HttpClient] fix
1 parentb8bf937 commit65609d8

File tree

5 files changed

+14
-27
lines changed

5 files changed

+14
-27
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
4040
'auth_ntlm' =>null,// array|string - an array containing the username as first value, and optionally the
4141
// password as the second one; or string like username:password - enabling NTLM auth
4242
];
43+
privatestatic$emptyDefaults =self::OPTIONS_DEFAULTS + ['auth_ntlm' =>null];
4344

4445
/**
4546
* @var LoggerInterface|null

‎src/Symfony/Component/HttpClient/HttpClientTrait.php‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
trait HttpClientTrait
2424
{
2525
privatestatic$CHUNK_SIZE =16372;
26-
privatestatic$emptyDefaults;
2726

2827
/**
2928
* Validates and normalizes method, URL and options, and merges them with defaults.
@@ -41,16 +40,6 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
4140
}
4241
}
4342

44-
if (null ===self::$emptyDefaults) {
45-
self::$emptyDefaults = [];
46-
47-
foreach ($defaultOptionsas$k =>$v) {
48-
if (null !==$v) {
49-
self::$emptyDefaults[$k] =$v;
50-
}
51-
}
52-
}
53-
5443
$options =self::mergeDefaultOptions($options,$defaultOptions,$allowExtraOptions);
5544

5645
$buffer =$options['buffer'] ??true;
@@ -200,11 +189,7 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
200189

201190
$options +=$defaultOptions;
202191

203-
if (null ===self::$emptyDefaults) {
204-
self::$emptyDefaults = [];
205-
}
206-
207-
foreach (self::$emptyDefaultsas$k =>$v) {
192+
foreach (self::$emptyDefaults ?? []as$k =>$v) {
208193
if (!isset($options[$k])) {
209194
$options[$k] =$v;
210195
}

‎src/Symfony/Component/HttpClient/NativeHttpClient.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
3636
use LoggerAwareTrait;
3737

3838
private$defaultOptions =self::OPTIONS_DEFAULTS;
39+
privatestatic$emptyDefaults =self::OPTIONS_DEFAULTS;
3940

4041
/** @var NativeClientState */
4142
private$multi;

‎src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,6 @@ public function testHandleIsReinitOnReset()
148148
self::assertNotSame($initialShareId,$clientState->share);
149149
}
150150

151-
publicfunctiontestNullBody()
152-
{
153-
$httpClient =$this->getHttpClient(__FUNCTION__);
154-
155-
$httpClient->request('POST','http://localhost:8057/post', [
156-
'body' =>null,
157-
]);
158-
159-
$this->expectNotToPerformAssertions();
160-
}
161-
162151
publicfunctiontestProcessAfterReset()
163152
{
164153
$client =$this->getHttpClient(__FUNCTION__);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,15 @@ public function testNegativeTimeout()
202202
'timeout' => -1,
203203
])->getStatusCode());
204204
}
205+
206+
publicfunctiontestNullBody()
207+
{
208+
$httpClient =$this->getHttpClient(__FUNCTION__);
209+
210+
$httpClient->request('POST','http://localhost:8057/post', [
211+
'body' =>null,
212+
]);
213+
214+
$this->expectNotToPerformAssertions();
215+
}
205216
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp