Update function domain test

This commit is contained in:
Khushboo Verma
2025-08-26 18:56:26 +05:30
parent e537337b8e
commit aac98b2ec7
3 changed files with 7 additions and 3 deletions
@@ -481,13 +481,13 @@ class Create extends Base
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
}
$executionResponse['headers']['x-appwrite-execution-id'] = $execution->getId();
$headers = [];
foreach (($executionResponse['headers'] ?? []) as $key => $value) {
$headers[] = ['name' => $key, 'value' => $value];
}
$headers[] = ['name' => 'x-appwrite-execution-id', 'value' => $execution->getId()];
$execution->setAttribute('responseBody', $executionResponse['body'] ?? '');
$execution->setAttribute('responseHeaders', $headers);
+2 -1
View File
@@ -543,13 +543,14 @@ class Functions extends Action
$status = $executionResponse['statusCode'] >= 500 ? 'failed' : 'completed';
$executionResponse['headers']['x-appwrite-execution-id'] = $execution->getId();
$headersFiltered = [];
foreach ($executionResponse['headers'] as $key => $value) {
if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_RESPONSE)) {
$headersFiltered[] = [ 'name' => $key, 'value' => $value ];
}
}
$headersFiltered[] = ['name' => 'x-appwrite-execution-id', 'value' => $execution->getId()];
$maxLogLength = APP_FUNCTION_LOG_LENGTH_LIMIT;
$logs = $executionResponse['logs'] ?? '';
@@ -1689,6 +1689,9 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($cookie, $response['body']);
$this->assertArrayHasKey('x-appwrite-execution-id', $response['headers']);
$this->assertNotEmpty($response['headers']['x-appwrite-execution-id']);
// Async execution document creation
$this->assertEventually(function () use ($functionId) {
$executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', array_merge([