Skip to content

Commit 2a99824

Browse files
authored
fix: correct content-type headers on typed function response (GoogleCloudPlatform#152)
1 parent 8c5bb47 commit 2a99824

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: src/TypedFunctionWrapper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ public function execute(ServerRequestInterface $request): ResponseInterface
9999
}
100100
$resultJson = $funcResult->serializeToJsonString();
101101

102-
return new Response(200, ['content-type' => 'application/cloudevents+json'], $resultJson);
102+
return new Response(200, ['content-type' => 'application/json'], $resultJson);
103103
}
104104
}

Diff for: tests/TypedFunctionWrapperTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function (IntValue $foo): IntValue {
109109
$request = new ServerRequest('POST', '/', ['content-type' => 'application/json'], '1');
110110
$response = $typedFunctionWrapper->execute($request);
111111
$this->assertSame('2', (string) $response->getBody());
112+
$this->assertSame('application/json', $response->getHeaderLine("Content-Type"));
112113
}
113114

114115
public function testBadRequest(): void

0 commit comments

Comments
 (0)