@@ -72,6 +72,33 @@ public function testGetRequest()
72
72
$ response ->getContent ();
73
73
}
74
74
75
+ public function testHeadRequest ()
76
+ {
77
+ $ client = $ this ->getHttpClient (__FUNCTION__ );
78
+ $ response = $ client ->request ('HEAD ' , 'http://localhost:8057 ' , [
79
+ 'headers ' => ['Foo ' => 'baR ' ],
80
+ 'user_data ' => $ data = new \stdClass (),
81
+ ]);
82
+
83
+ $ this ->assertSame ([], $ response ->getInfo ('response_headers ' ));
84
+ $ this ->assertSame ($ data , $ response ->getInfo ()['user_data ' ]);
85
+ $ this ->assertSame (200 , $ response ->getStatusCode ());
86
+
87
+ $ info = $ response ->getInfo ();
88
+ $ this ->assertNull ($ info ['error ' ]);
89
+ $ this ->assertSame (0 , $ info ['redirect_count ' ]);
90
+ $ this ->assertSame ('HTTP/1.1 200 OK ' , $ info ['response_headers ' ][0 ]);
91
+ $ this ->assertSame ('Host: localhost:8057 ' , $ info ['response_headers ' ][1 ]);
92
+ $ this ->assertSame ('http://localhost:8057/ ' , $ info ['url ' ]);
93
+
94
+ $ headers = $ response ->getHeaders ();
95
+
96
+ $ this ->assertSame ('localhost:8057 ' , $ headers ['host ' ][0 ]);
97
+ $ this ->assertSame (['application/json ' ], $ headers ['content-type ' ]);
98
+
99
+ $ this ->assertSame ('' , $ response ->getContent ());
100
+ }
101
+
75
102
public function testNonBufferedGetRequest ()
76
103
{
77
104
$ client = $ this ->getHttpClient (__FUNCTION__ );
0 commit comments