fix(http): flatten PSR-7 request headers before forwarding to executor

UsageTest::testCustomDomainsFunctionStats hit a 500: the function/site
execution proxy forwards $request->getHeaders() to the executor as a
{name: value} string map, but rc5's getHeaders() returns each header as
a PSR-7 list of values. The array-valued headers broke the multipart
executor request. Collapse them to single-line strings at the boundary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
loks0nandClaude Opus 4.8 committed 2026-06-10 10:08:45 +01:00
1 parent e087554db7
commit 4870e2eb50
1 file changed
+7 -3
+7 -3
View File
@@ -293,7 +293,12 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S
$body = $swooleRequest->getContent() ?: '';
$method = $swooleRequest->server['request_method'];
$requestHeaders = $request->getHeaders();
// getHeaders() follows PSR-7 and returns each header as a list of values;
// collapse to single-line strings for the function/site header map below.
$requestHeaders = \array_map(
static fn (array $values) => \implode(', ', $values),
$request->getHeaders()
);
if ($resource->isEmpty() || !$resource->getAttribute('enabled')) {
if ($type === 'function') {
@@ -400,8 +405,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S
$headersFiltered = [];
foreach ($headers as $key => $value) {
if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) {
// Request headers follow PSR-7 and arrive as a list of values; collapse to a single line.
$headersFiltered[] = ['name' => $key, 'value' => \is_array($value) ? \implode(', ', $value) : $value];
$headersFiltered[] = ['name' => $key, 'value' => $value];
}
}