From d7c5d8bb46df33ff3f5223e14b7cd392a6e0e644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 27 Feb 2023 11:20:37 +0100 Subject: [PATCH] Remove response body & headers --- app/config/collections.php | 22 ---------------------- app/controllers/api/functions.php | 7 ++----- app/workers/functions.php | 4 ---- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 6eb947a121..3d9433fb11 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2931,17 +2931,6 @@ $collections = [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('body'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 1000000, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], [ '$id' => ID::custom('errors'), 'type' => Database::VAR_STRING, @@ -2975,17 +2964,6 @@ $collections = [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('headers'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 16384, - 'signed' => true, - 'required' => false, - 'default' => [], - 'array' => false, - 'filters' => ['json'], - ], [ '$id' => ID::custom('duration'), 'type' => Database::VAR_FLOAT, diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index b18a617169..ffa112f795 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1180,8 +1180,6 @@ App::post('/v1/functions/:functionId/executions') 'trigger' => 'http', // http / schedule / event 'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed 'statusCode' => 0, - 'body' => '', - 'headers' => [], 'errors' => '', 'logs' => '', 'duration' => 0.0, @@ -1279,8 +1277,6 @@ App::post('/v1/functions/:functionId/executions') $status = $executionResponse['statusCode'] >= 500 ? 'failed' : 'completed'; $execution->setAttribute('status', $status); $execution->setAttribute('statusCode', $executionResponse['statusCode']); - $execution->setAttribute('headers', $executionResponse['headers']); - $execution->setAttribute('body', $executionResponse['body']); $execution->setAttribute('logs', $executionResponse['logs']); $execution->setAttribute('errors', $executionResponse['errors']); $execution->setAttribute('duration', $executionResponse['duration']); @@ -1295,7 +1291,6 @@ App::post('/v1/functions/:functionId/executions') } if($function->getAttribute('logging')) { - $execution->setAttribute('body', \mb_strcut($execution->getAttribute('body') , 0, 1000000)); // Limit to 1MB Authorization::skip(fn () => $dbForProject->updateDocument('executions', $executionId, $execution)); } @@ -1315,6 +1310,8 @@ App::post('/v1/functions/:functionId/executions') $execution->setAttribute('errors', ''); } + $execution->setAttribute('body', $executionResponse['body']); + $response ->setStatusCode(Response::STATUS_CODE_CREATED) ->dynamic($execution, Response::MODEL_EXECUTION); diff --git a/app/workers/functions.php b/app/workers/functions.php index 2cfd78779c..02e109a1dc 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -89,8 +89,6 @@ Server::setResource('execute', function () { 'trigger' => $trigger, 'status' => 'processing', 'statusCode' => 0, - 'body' => '', - 'headers' => [], 'errors' => '', 'logs' => '', 'duration' => 0.0, @@ -161,8 +159,6 @@ Server::setResource('execute', function () { $execution ->setAttribute('status', $status) ->setAttribute('statusCode', $executionResponse['statusCode']) - ->setAttribute('headers', $executionResponse['headers']) - ->setAttribute('body', $executionResponse['body']) ->setAttribute('logs', $executionResponse['logs']) ->setAttribute('errors', $executionResponse['errors']) ->setAttribute('duration', $executionResponse['duration']);