Skip to content

Commit

Permalink
fix multiple query params
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed May 24, 2024
1 parent c3cdb8b commit 46c9db6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Runtime/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ protected static function getUriAndQueryString(array $event)

$queryString = self::getQueryString($event);

parse_str($queryString, $queryParameters);

return [
empty($queryString) ? $uri : $uri.'?'.$queryString,
http_build_query($queryParameters),
$queryString,
];
}

Expand All @@ -127,7 +125,7 @@ protected static function getUriAndQueryString(array $event)
protected static function getQueryString(array $event)
{
if (isset($event['version']) && $event['version'] === '2.0') {
return http_build_query(
return self::buildQueryString(
collect($event['queryStringParameters'] ?? [])
->mapWithKeys(function ($value, $key) {
$values = explode(',', $value);
Expand All @@ -140,12 +138,12 @@ protected static function getQueryString(array $event)
}

if (! isset($event['multiValueQueryStringParameters'])) {
return http_build_query(
return self::buildQueryString(
$event['queryStringParameters'] ?? []
);
}

return http_build_query(
return self::buildQueryString(
collect($event['multiValueQueryStringParameters'] ?? [])
->mapWithKeys(function ($values, $key) use ($event) {
$key = ! isset($event['requestContext']['elb']) ? $key : urldecode($key);
Expand Down

0 comments on commit 46c9db6

Please sign in to comment.