Make application/json as default

This commit is contained in:
Khushboo Verma 2024-08-11 17:56:02 +05:30
parent c8d04c11eb
commit 8667e9f821

View file

@ -1952,12 +1952,12 @@ App::post('/v1/functions/:functionId/executions')
$execution->setAttribute('responseBody', $executionResponse['body'] ?? '');
$execution->setAttribute('responseHeaders', $headers);
$isJson = false;
$isJson = true;
$acceptTypes = \explode(', ', $request->getHeader('accept', 'application/json'));
foreach ($acceptTypes as $acceptType) {
if (\str_starts_with($acceptType, 'application/json') || \str_starts_with($acceptType, 'application/*')) {
$isJson = true;
if (\str_starts_with($acceptType, 'multipart/form-data') || \str_starts_with($acceptType, 'multipart/*')) {
$isJson = false;
break;
}
}