diff --git a/src/HttpSignatures/GuzzleHttpSignatures.php b/src/HttpSignatures/GuzzleHttpSignatures.php index 8b774f7..0d060ff 100644 --- a/src/HttpSignatures/GuzzleHttpSignatures.php +++ b/src/HttpSignatures/GuzzleHttpSignatures.php @@ -25,13 +25,14 @@ class GuzzleHttpSignatures */ public static function middlewareFromContext(Context $context) { - return function (callable $handler) use ($context) - { + return function (callable $handler) use ($context) { return function ( Request $request, 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); return $handler($request, $options); };