Support array headers for set-cookie

This commit is contained in:
Matej Bačo
2025-09-03 17:32:15 +02:00
parent 101da34672
commit b75952071e
4 changed files with 61 additions and 31 deletions
+10 -2
View File
@@ -9,6 +9,12 @@ use Utopia\System\System;
class Executor
{
// 0.8.6 is last version with object-based headers
public const RESPONSE_FORMAT_OBJECT_HEADERS = '0.10.0';
// 0.9.0 is first version with array-based headers
public const RESPONSE_FORMAT_ARRAY_HEADERS = '0.11.0';
public const METHOD_GET = 'GET';
public const METHOD_POST = 'POST';
public const METHOD_PUT = 'PUT';
@@ -170,6 +176,7 @@ class Executor
* @param string $entrypoint
* @param string $runtimeEntrypoint
* @param bool $logging
* @param string $responseFormat
*
* @return array
*/
@@ -190,7 +197,8 @@ class Executor
int $memory,
bool $logging,
string $runtimeEntrypoint = '',
?int $requestTimeout = null
?int $requestTimeout = null,
string $responseFormat = self::RESPONSE_FORMAT_OBJECT_HEADERS
) {
if (empty($headers['host'])) {
$headers['host'] = System::getEnv('_APP_DOMAIN', '');
@@ -232,7 +240,7 @@ class Executor
$requestTimeout = $timeout + 15;
}
$response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId, 'content-type' => 'multipart/form-data', 'accept' => 'multipart/form-data' ], $params, true, $requestTimeout);
$response = $this->call($this->endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId, 'content-type' => 'multipart/form-data', 'accept' => 'multipart/form-data', 'x-executor-response-format' => $responseFormat ], $params, true, $requestTimeout);
$status = $response['headers']['status-code'];
if ($status >= 400) {