1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Merge pull request #3781 from appwrite/fix-async-default-value

Update createExecution param default value
This commit is contained in:
Eldad A. Fux 2022-09-07 21:39:46 +03:00 committed by GitHub
commit 30e18d43a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

View file

@ -9,6 +9,7 @@
- Resources that are computed asynchronously, such as function deployments, will now return a `202 Accepted` status code instead of `200 OK` [#3547](https://github.com/appwrite/appwrite/pull/3547)
- Queries have been improved to allow even more flexibility, and introduced to new endpoints. See the Queries V2 section in the document for more information [#3702](https://github.com/appwrite/appwrite/pull/3702)
- Compound indexes are now more flexible [#151](https://github.com/utopia-php/database/pull/151)
- `createExecution` parameter `async` default value was changed from `true` to `false` [#3781](https://github.com/appwrite/appwrite/pull/3781)
## Features
- Added the UI to see the Parent ID of all resources within the UI. [#3653](https://github.com/appwrite/appwrite/pull/3653)

View file

@ -938,7 +938,7 @@ App::post('/v1/functions/:functionId/executions')
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->param('functionId', '', new UID(), 'Function ID.')
->param('data', '', new Text(8192), 'String of custom data to send to function.', true)
->param('async', true, new Boolean(), 'Execute code asynchronously. Default value is true.', true)
->param('async', false, new Boolean(), 'Execute code in the background. Default value is false.', true)
->inject('response')
->inject('project')
->inject('dbForProject')

View file

@ -245,6 +245,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$this->assertEquals(202, $execution['headers']['status-code']);
@ -343,6 +344,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId,
], [
'data' => 'foobar',
'async' => true,
]);
$this->assertEquals(202, $execution['headers']['status-code']);
@ -388,6 +390,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$this->assertEquals(202, $execution['headers']['status-code']);
@ -568,7 +571,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), [
'data' => 'foobar',
'async' => false
// Testing default value, should be 'async' => false
]);
$output = json_decode($execution['body']['response'], true);

View file

@ -738,7 +738,7 @@ class FunctionsCustomServerTest extends Scope
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'async' => false,
// Testing default value, should be 'async' => false
]);
$this->assertEquals(201, $execution['headers']['status-code']);
@ -979,6 +979,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';
@ -1093,6 +1094,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';
@ -1205,6 +1207,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';
@ -1318,6 +1321,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';
@ -1431,6 +1435,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'data' => 'foobar',
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';

View file

@ -1262,7 +1262,9 @@ class RealtimeCustomClientTest extends Scope
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()), []);
], $this->getHeaders()), [
'async' => true
]);
$this->assertEquals($execution['headers']['status-code'], 202);
$this->assertNotEmpty($execution['body']['$id']);

View file

@ -605,7 +605,9 @@ class WebhooksCustomServerTest extends Scope
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $id . '/executions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
], $this->getHeaders()), [
'async' => true
]);
$executionId = $execution['body']['$id'] ?? '';