mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Merge pull request #8547 from appwrite/fix-templateBranch-in-request-filter
Default fallback to for templateBranch
This commit is contained in:
commit
07525350b2
2 changed files with 29 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ class V18 extends Filter
|
|||
unset($content['otp']);
|
||||
break;
|
||||
case 'functions.create':
|
||||
$content['templateVersion'] = $content['templateBranch'];
|
||||
$content['templateVersion'] = $content['templateBranch'] ?? "";
|
||||
unset($content['templateBranch']);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,8 +454,8 @@ class FunctionsCustomServerTest extends Scope
|
|||
$entrypoint = null;
|
||||
$rootDirectory = null;
|
||||
$commands = null;
|
||||
foreach($template['body']['runtimes'] as $runtime) {
|
||||
if($runtime["name"] !== $runtimeName) {
|
||||
foreach ($template['body']['runtimes'] as $runtime) {
|
||||
if ($runtime["name"] !== $runtimeName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2419,4 +2419,30 @@ class FunctionsCustomServerTest extends Scope
|
|||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
}
|
||||
|
||||
public function testCreateFunctionWithResponseFormatHeader()
|
||||
{
|
||||
$response = $this->client->call(Client::METHOD_POST, '/functions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-response-format' => '1.5.0', // add response format header
|
||||
], $this->getHeaders()), [
|
||||
'functionId' => ID::unique(),
|
||||
'name' => 'Test',
|
||||
'runtime' => 'php-8.0',
|
||||
'entrypoint' => 'index.php',
|
||||
'timeout' => 15,
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
|
||||
// Cleanup : Delete function
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $response['body']['$id'], [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], []);
|
||||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue