Skip to content

Commit 2f00baa

Browse files
committed
allow to set custom http headers
1 parent a20d711 commit 2f00baa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Http/CurlDispatcher.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class CurlDispatcher implements DispatcherInterface
2525
];
2626

2727
private $config = [
28+
CURLOPT_HTTPHEADER => [],
2829
CURLOPT_MAXREDIRS => 10,
2930
CURLOPT_CONNECTTIMEOUT => 10,
3031
CURLOPT_TIMEOUT => 10,
@@ -94,9 +95,9 @@ public function dispatch(Url $url)
9495
$extension = $url->getExtension();
9596

9697
if (!empty($extension) && isset(self::$acceptHeaders[$extension])) {
97-
$options[CURLOPT_HTTPHEADER] = ['Accept: '.self::$acceptHeaders[$extension]];
98+
$options[CURLOPT_HTTPHEADER][] = 'Accept: '.self::$acceptHeaders[$extension];
9899
} else {
99-
$options[CURLOPT_HTTPHEADER] = ['Accept: */*'];
100+
$options[CURLOPT_HTTPHEADER][] = 'Accept: */*';
100101
}
101102

102103
$response = $this->exec($url, $options);

0 commit comments

Comments
 (0)