From 608e8753cc425bd7984ae0343ac944df656ec624 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 May 2023 01:10:06 +0000 Subject: [PATCH] update test and code format --- app/init.php | 3 ++- tests/e2e/Services/Account/AccountCustomClientTest.php | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/init.php b/app/init.php index 292c54bb35..eb664f9b55 100644 --- a/app/init.php +++ b/app/init.php @@ -872,7 +872,8 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons } } - $authJWT = $request->getParam('jwt', $request->getHeader('x-appwrite-jwt', ''));; + $authJWT = $request->getParam('jwt', $request->getHeader('x-appwrite-jwt', '')); + ; if (!empty($authJWT) && !$project->isEmpty()) { // JWT authentication $jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 6f75a998c1..ebe917e513 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -328,6 +328,15 @@ class AccountCustomClientTest extends Scope $this->assertEquals($response['headers']['status-code'], 200); + // JWT as request param + $response = $this->client->call(Client::METHOD_GET, '/account?jwt=' . $jwt, array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals($response['headers']['status-code'], 200); + $response = $this->client->call(Client::METHOD_DELETE, '/account/sessions/' . $sessionId, array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json',