fix: update console redirect to include query params
Use `$request->getParams()` because `$request->getURI()` does not include the query string.
This commit is contained in:
parent
6ff1758873
commit
afdf34c45c
2 changed files with 16 additions and 2 deletions
|
@ -32,8 +32,9 @@ App::get('/')
|
|||
->action(function (Request $request, Response $response) {
|
||||
$url = parse_url($request->getURI());
|
||||
$target = "/console{$url['path']}";
|
||||
if ($url['query'] ?? false) {
|
||||
$target .= "?{$url['query']}";
|
||||
$params = $request->getParams();
|
||||
if (!empty($params)) {
|
||||
$target .= "?" . \http_build_query($params);
|
||||
}
|
||||
if ($url['fragment'] ?? false) {
|
||||
$target .= "#{$url['fragment']}";
|
||||
|
|
|
@ -216,4 +216,17 @@ class HTTPTest extends Scope
|
|||
|
||||
$this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']);
|
||||
}
|
||||
|
||||
public function testConsoleRedirect()
|
||||
{
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
|
||||
$endpoint = '/invite?membershipId=123&userId=asdf';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, $endpoint);
|
||||
|
||||
$this->assertEquals('/console' . $endpoint, $response['headers']['location']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue