diff --git a/mock-server/app/http.php b/mock-server/app/http.php index 96c61ac41..84692d031 100644 --- a/mock-server/app/http.php +++ b/mock-server/app/http.php @@ -74,9 +74,10 @@ ->label('scope', 'public') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) - ->inject('response') - ->param('projectId', '', new Text(256), 'Project ID') - ->action(function () { + ->inject('request') + ->action(function (Request $request) { + $projectId = $request->getHeader('x-appwrite-project', ''); + if (empty($projectId)) { throw new Exception(Exception::GENERAL_MOCK, 'Missing project ID'); } diff --git a/templates/node/src/client.ts.twig b/templates/node/src/client.ts.twig index c9937444e..7dffac1cf 100644 --- a/templates/node/src/client.ts.twig +++ b/templates/node/src/client.ts.twig @@ -241,7 +241,7 @@ class Client { } async ping(): Promise { - return this.call('GET', new URL('/ping', this.config.endpoint), {}, {}, 'json'); + return this.call('GET', new URL(this.config.endpoint + '/ping')); } async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise { diff --git a/templates/web/src/client.ts.twig b/templates/web/src/client.ts.twig index 1feb49ebd..4d0cac6df 100644 --- a/templates/web/src/client.ts.twig +++ b/templates/web/src/client.ts.twig @@ -635,7 +635,7 @@ class Client { } async ping(): Promise { - return this.call('GET', new URL('/ping', this.config.endpoint), {}, {}, 'json'); + return this.call('GET', new URL(this.config.endpoint + '/ping')); } async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise {