add digest generation
This commit is contained in:
parent
920ddd3cfb
commit
7efe3cb56f
|
@ -25,13 +25,14 @@ class GuzzleHttpSignatures
|
||||||
*/
|
*/
|
||||||
public static function middlewareFromContext(Context $context)
|
public static function middlewareFromContext(Context $context)
|
||||||
{
|
{
|
||||||
return function (callable $handler) use ($context)
|
return function (callable $handler) use ($context) {
|
||||||
{
|
|
||||||
return function (
|
return function (
|
||||||
Request $request,
|
Request $request,
|
||||||
array $options
|
array $options
|
||||||
) use ($handler, $context)
|
) use ($handler, $context) {
|
||||||
{
|
|
||||||
|
$contentsRequest = (string) $request->getBody();
|
||||||
|
$request = $request->withAddedHeader("digest", base64_encode(hash('sha512', $contentsRequest, true)));
|
||||||
$request = $context->signer()->sign($request);
|
$request = $context->signer()->sign($request);
|
||||||
return $handler($request, $options);
|
return $handler($request, $options);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue