1
0
Fork 0
mirror of synced 2024-09-28 15:31:43 +12:00

Merge pull request #8619 from appwrite/fix-console-redirect-query-params

Update console redirect to include query params
This commit is contained in:
Torsten Dittmann 2024-09-04 19:05:02 +02:00 committed by GitHub
commit e11cbd222e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View file

@ -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']}";

View file

@ -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']);
}
}