mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-27 16:26:37 +03:00
Replaced standard http_build_query by guzzle's build_query, which keeps params with no value
This commit is contained in:
parent
15a72e2a88
commit
c52794aed6
2 changed files with 3 additions and 8 deletions
|
@ -20,8 +20,8 @@ use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
|||
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function GuzzleHttp\Psr7\build_query;
|
||||
use function GuzzleHttp\Psr7\parse_query;
|
||||
use function http_build_query;
|
||||
|
||||
abstract class AbstractTrackingAction implements MiddlewareInterface
|
||||
{
|
||||
|
@ -42,12 +42,6 @@ abstract class AbstractTrackingAction implements MiddlewareInterface
|
|||
$this->logger = $logger ?: new NullLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an incoming server request and return a response, optionally delegating
|
||||
* to the next middleware component to create the response.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$shortCode = $request->getAttribute('shortCode', '');
|
||||
|
@ -79,7 +73,7 @@ abstract class AbstractTrackingAction implements MiddlewareInterface
|
|||
}
|
||||
$mergedQuery = array_merge($hardcodedQuery, $currentQuery);
|
||||
|
||||
return (string) $uri->withQuery(http_build_query($mergedQuery));
|
||||
return (string) $uri->withQuery(build_query($mergedQuery));
|
||||
}
|
||||
|
||||
abstract protected function createSuccessResp(string $longUrl): ResponseInterface;
|
||||
|
|
|
@ -64,6 +64,7 @@ class RedirectActionTest extends TestCase
|
|||
{
|
||||
yield ['http://domain.com/foo/bar?some=thing', []];
|
||||
yield ['http://domain.com/foo/bar?some=thing', ['foobar' => 'notrack']];
|
||||
yield ['http://domain.com/foo/bar?some=thing&else', ['else' => null]];
|
||||
yield ['http://domain.com/foo/bar?some=thing&foo=bar', ['foo' => 'bar']];
|
||||
yield ['http://domain.com/foo/bar?some=overwritten&foo=bar', ['foo' => 'bar', 'some' => 'overwritten']];
|
||||
yield ['http://domain.com/foo/bar?some=overwritten', ['foobar' => 'notrack', 'some' => 'overwritten']];
|
||||
|
|
Loading…
Reference in a new issue