Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f2c3155

Browse files
joshlopesrossmotley
authored andcommitted
Fix guzzle 6 (#10)
1 parent ee04775 commit f2c3155

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/Amara/OneHydra/Http/Transport/GuzzleTransport.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,14 @@ public function execute(HttpRequestInterface $request)
4444
$guzzleRequest = new Request(
4545
$request->getMethod(),
4646
$request->getUrl(),
47-
[
48-
'query' => $request->getParams(),
49-
'headers' => $request->getHeaders(),
50-
]
47+
$request->getHeaders()
5148
);
5249

5350
try {
54-
$clientResponse = $this->guzzleClient->send($guzzleRequest);
51+
$clientResponse = $this->guzzleClient->send($guzzleRequest, ['query' => $request->getParams()]);
5552
} catch (RequestException $e) {
5653
// Re-throw guzzle exception as our own
57-
throw new HttpTransportException("Guzzle exception", 0, $e);
54+
throw new HttpTransportException('Guzzle exception', 0, $e);
5855
}
5956

6057
return (new HttpResponse())

tests/Amara/OneHydra/Http/Transport/GuzzleTransportTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testExecuteWhenOkay()
3636
$method = 'GET';
3737
$url = '/foo';
3838
$params = ['oh' => 'hai'];
39-
$headers = ['oh' => 'really'];
39+
$headers = ['oh' => ['really']];
4040

4141
$responseBody = '{}';
4242
$responseHeaders = ['went' => 'great'];
@@ -55,12 +55,12 @@ function (Request $request) use ($method, $url, $headers) {
5555
$this->assertEquals($url, $request->getUri());
5656
$this->assertEquals(
5757
$headers,
58-
$request->getHeaders()['headers']
58+
$request->getHeaders()
5959
);
6060

6161
return true;
6262
}
63-
)
63+
), ['query' => $params]
6464
)->willReturn($guzzleResponse);
6565

6666
$guzzleTransport = new GuzzleTransport($guzzleClient->reveal());
@@ -85,7 +85,7 @@ public function testExecuteWhenGuzzleThrowsException()
8585

8686
$request = $this->getRequestMock($url, $params, $headers, $method);
8787
$guzzleClient = $this->prophesize(Client::class);
88-
$guzzleClient->send(Argument::type(Request::class))->willThrow(
88+
$guzzleClient->send(Argument::type(Request::class), ['query' => $params])->willThrow(
8989
RequestException::class
9090
);
9191

0 commit comments

Comments
 (0)