update test and code format

This commit is contained in:
Damodar Lohani
2023-05-02 01:10:06 +00:00
parent c63f37195a
commit 608e8753cc
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -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.
@@ -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',