Skip to content

Commit d35bbd8

Browse files
Merge branch '4.3' into 4.4
* 4.3: [Config] Disable default alphabet sorting in glob function due of unstable sort [HttpClient] always return the empty string when the response cannot have a body [TwigBundle][exception] Added missing css variable to highlight line in trace [Serializer] Improve messages for unexpected resources values [SecurityBundle] correct types for default arguments for firewall configs
2 parents 7972a40 + 88d3fc9 commit d35bbd8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

HttpClient/Test/Fixtures/web/index.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@
2929
}
3030
}
3131

32+
$json = json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
33+
3234
switch ($vars['REQUEST_URI']) {
3335
default:
3436
exit;
3537

38+
case '/head':
39+
header('Content-Length: '.strlen($json), true);
40+
break;
41+
3642
case '/':
3743
case '/?a=a&b=b':
3844
case 'http://127.0.0.1:8057/':
3945
case 'http://localhost:8057/':
40-
header('Content-Type: application/json');
4146
ob_start('ob_gzhandler');
4247
break;
4348

@@ -85,6 +90,7 @@
8590
case '/304':
8691
header('Content-Length: 10', true, 304);
8792
echo '12345';
93+
8894
return;
8995

9096
case '/307':
@@ -153,4 +159,4 @@
153159

154160
header('Content-Type: application/json', true);
155161

156-
echo json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
162+
echo $json;

HttpClient/Test/HttpClientTestCase.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,24 @@ public function testGetRequest()
7575
public function testHeadRequest()
7676
{
7777
$client = $this->getHttpClient(__FUNCTION__);
78-
$response = $client->request('HEAD', 'http://localhost:8057', [
78+
$response = $client->request('HEAD', 'http://localhost:8057/head', [
7979
'headers' => ['Foo' => 'baR'],
8080
'user_data' => $data = new \stdClass(),
81+
'buffer' => false,
8182
]);
8283

8384
$this->assertSame([], $response->getInfo('response_headers'));
84-
$this->assertSame($data, $response->getInfo()['user_data']);
8585
$this->assertSame(200, $response->getStatusCode());
8686

8787
$info = $response->getInfo();
88-
$this->assertNull($info['error']);
89-
$this->assertSame(0, $info['redirect_count']);
9088
$this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]);
9189
$this->assertSame('Host: localhost:8057', $info['response_headers'][1]);
92-
$this->assertSame('http://localhost:8057/', $info['url']);
9390

9491
$headers = $response->getHeaders();
9592

9693
$this->assertSame('localhost:8057', $headers['host'][0]);
9794
$this->assertSame(['application/json'], $headers['content-type']);
95+
$this->assertTrue(0 < $headers['content-length'][0]);
9896

9997
$this->assertSame('', $response->getContent());
10098
}
@@ -329,6 +327,7 @@ public function test304()
329327
$client = $this->getHttpClient(__FUNCTION__);
330328
$response = $client->request('GET', 'http://localhost:8057/304', [
331329
'headers' => ['If-Match' => '"abc"'],
330+
'buffer' => false,
332331
]);
333332

334333
$this->assertSame(304, $response->getStatusCode());

0 commit comments

Comments
 (0)