File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ class WebClient extends Client
54
54
protected $ options =
55
55
[
56
56
CURLINFO_HEADER_OUT => true ,
57
+ CURLOPT_HTTPHEADER => [],
57
58
CURLOPT_PUT => true ,
58
59
CURLOPT_RETURNTRANSFER => true ,
59
60
CURLOPT_TIMEOUT => 5 ,
@@ -213,7 +214,10 @@ public function request($type, $file = null)
213
214
$ options = $ this ->getCurlOptions ($ type , $ file );
214
215
215
216
// sets headers
216
- $ options [CURLOPT_HTTPHEADER ] = $ headers ;
217
+ foreach ($ headers as $ header )
218
+ {
219
+ $ options [CURLOPT_HTTPHEADER ][] = $ header ;
220
+ }
217
221
218
222
// cURL init and options
219
223
$ options [CURLOPT_URL ] = "http:// {$ this ->host }: {$ this ->port }" . "/ $ resource " ;
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ public function testDocumentMainText($file)
216
216
217
217
if ($ client ::MODE == 'web ' && version_compare (self ::$ version , '1.15 ' ) < 0 )
218
218
{
219
- $ this ->markTestSkipped ('Apache Tika ' . self ::$ version . 'lacks main content extraction ' );
219
+ $ this ->markTestSkipped ('Apache Tika ' . self ::$ version . ' lacks main content extraction ' );
220
220
}
221
221
else
222
222
{
@@ -344,7 +344,7 @@ public function testMainTextCallback($file)
344
344
345
345
if ($ client ::MODE == 'web ' && version_compare (self ::$ version , '1.15 ' ) < 0 )
346
346
{
347
- $ this ->markTestSkipped ('Apache Tika ' . self ::$ version . 'lacks main content extraction ' );
347
+ $ this ->markTestSkipped ('Apache Tika ' . self ::$ version . ' lacks main content extraction ' );
348
348
}
349
349
else
350
350
{
Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ public function testCurlOptions()
30
30
$ this ->assertEquals (3 , $ options [CURLOPT_TIMEOUT ]);
31
31
}
32
32
33
+ /**
34
+ * cURL headers test
35
+ */
36
+ public function testCurlHeaders ()
37
+ {
38
+ $ header = 'Content-Type: image/jpeg ' ;
39
+
40
+ $ client = Client::make ('localhost ' , 9998 , [CURLOPT_HTTPHEADER => [$ header ]]);
41
+ $ options = $ client ->getOptions ();
42
+
43
+ $ this ->assertContains ($ header , $ options [CURLOPT_HTTPHEADER ]);
44
+ }
45
+
33
46
/**
34
47
* Set host test
35
48
*/
You can’t perform that action at this time.
0 commit comments