Skip to content

Commit

Permalink
Fixed bad signing of ES requests issue jeskew#12
Browse files Browse the repository at this point in the history
  • Loading branch information
d-melnyk committed May 15, 2018
1 parent b5cc8c2 commit 0128b18
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ElasticsearchPhpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public function __invoke(array $request)
$signedRequest = $this->signer
->signRequest($psr7Request, $creds);

return call_user_func($this->wrappedHandler, array_replace(
$request,
$this->createRingRequest($signedRequest)
));
return call_user_func($this->wrappedHandler, $this->createRingRequest($signedRequest));
}

private function createPsr7Request(array $ringPhpRequest)
Expand All @@ -62,6 +59,8 @@ private function createPsr7Request(array $ringPhpRequest)
$ringPhpRequest['headers'][$hostKey][0]
= parse_url($ringPhpRequest['headers'][$hostKey][0])['host'];

$ringPhpRequest['headers']['Content-Type'] = 'application/json';

// Create a PSR-7 URI from the array passed to the handler
$uri = (new Uri($ringPhpRequest['uri']))
->withScheme($ringPhpRequest['scheme'])
Expand Down

0 comments on commit 0128b18

Please sign in to comment.