Initial Commit
This commit is contained in:
16
dependencies/amphp/http-client/src/Interceptor/SetRequestHeader.php
vendored
Normal file
16
dependencies/amphp/http-client/src/Interceptor/SetRequestHeader.php
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Ultimo\Dependencies\Amp\Http\Client\Interceptor;
|
||||
|
||||
use WP_Ultimo\Dependencies\Amp\Http\Client\Request;
|
||||
final class SetRequestHeader extends ModifyRequest
|
||||
{
|
||||
public function __construct(string $headerName, string $headerValue, string ...$headerValues)
|
||||
{
|
||||
\array_unshift($headerValues, $headerValue);
|
||||
parent::__construct(static function (Request $request) use($headerName, $headerValues) {
|
||||
$request->setHeader($headerName, $headerValues);
|
||||
return $request;
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user