@@ -88,12 +88,12 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
8888 unset($ options ['json ' ]);
8989
9090 if (!isset ($ options ['normalized_headers ' ]['content-type ' ])) {
91- $ options ['normalized_headers ' ]['content-type ' ] = [$ options [ ' headers ' ][] = 'Content-Type: application/json ' ];
91+ $ options ['normalized_headers ' ]['content-type ' ] = ['Content-Type: application/json ' ];
9292 }
9393 }
9494
9595 if (!isset ($ options ['normalized_headers ' ]['accept ' ])) {
96- $ options ['normalized_headers ' ]['accept ' ] = [$ options [ ' headers ' ][] = 'Accept: */* ' ];
96+ $ options ['normalized_headers ' ]['accept ' ] = ['Accept: */* ' ];
9797 }
9898
9999 if (isset ($ options ['body ' ])) {
@@ -104,7 +104,6 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
104104 && ('' !== $ h || ('' !== $ options ['body ' ] && !isset ($ options ['normalized_headers ' ]['transfer-encoding ' ])))
105105 ) {
106106 $ options ['normalized_headers ' ]['content-length ' ] = [substr_replace ($ h ?: 'Content-Length: ' , \strlen ($ options ['body ' ]), 16 )];
107- $ options ['headers ' ] = array_merge (...array_values ($ options ['normalized_headers ' ]));
108107 }
109108 }
110109
@@ -146,11 +145,11 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
146145 if (null !== $ url ) {
147146 // Merge auth with headers
148147 if (($ options ['auth_basic ' ] ?? false ) && !($ options ['normalized_headers ' ]['authorization ' ] ?? false )) {
149- $ options ['normalized_headers ' ]['authorization ' ] = [$ options [ ' headers ' ][] = 'Authorization: Basic ' .base64_encode ($ options ['auth_basic ' ])];
148+ $ options ['normalized_headers ' ]['authorization ' ] = ['Authorization: Basic ' .base64_encode ($ options ['auth_basic ' ])];
150149 }
151150 // Merge bearer with headers
152151 if (($ options ['auth_bearer ' ] ?? false ) && !($ options ['normalized_headers ' ]['authorization ' ] ?? false )) {
153- $ options ['normalized_headers ' ]['authorization ' ] = [$ options [ ' headers ' ][] = 'Authorization: Bearer ' .$ options ['auth_bearer ' ]];
152+ $ options ['normalized_headers ' ]['authorization ' ] = ['Authorization: Bearer ' .$ options ['auth_bearer ' ]];
154153 }
155154
156155 unset($ options ['auth_basic ' ], $ options ['auth_bearer ' ]);
@@ -172,6 +171,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
172171 }
173172
174173 $ options ['max_duration ' ] = isset ($ options ['max_duration ' ]) ? (float ) $ options ['max_duration ' ] : 0 ;
174+ $ options ['headers ' ] = array_merge (...array_values ($ options ['normalized_headers ' ]));
175175
176176 return [$ url , $ options ];
177177 }
0 commit comments