Skip to content

Commit

Permalink
Adds query params tests to API Gateway tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Oct 5, 2021
1 parent 0a6ac40 commit dd63851
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/Feature/OctaneHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ public function test_request_query_string()

$response = $handler->handle([
'httpMethod' => 'GET',
'path' => '/?foo=bar',
'path' => '/',
'multiValueQueryStringParameters' => [
'foo' => ['bar'],
],
'headers' => [
'cookie' => 'XSRF-TOKEN=token_value',
],
Expand All @@ -324,6 +327,28 @@ public function test_request_query_string()
static::assertEquals('foo=bar', $response->toApiGatewayFormat()['body']);
}

public function test_request_query_params()
{
$handler = new OctaneHandler();

Route::get('/', function (Request $request) {
return $request->query();
});

$response = $handler->handle([
'httpMethod' => 'GET',
'path' => '/',
'multiValueQueryStringParameters' => [
'foo' => ['bar'],
],
'headers' => [
'cookie' => 'XSRF-TOKEN=token_value',
],
]);

static::assertEquals(['foo' => 'bar'], json_decode($response->toApiGatewayFormat()['body'], true));
}

public function test_request_headers()
{
$handler = new OctaneHandler();
Expand Down

0 comments on commit dd63851

Please sign in to comment.