mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
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:
1 parent
e087554db7
commit
4870e2eb50
1 file changed
+7
-3
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user