Skip to content

Commit

Permalink
fix: correct content-type headers on typed function response (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge authored Jun 26, 2023
1 parent 8c5bb47 commit 2a99824
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TypedFunctionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ public function execute(ServerRequestInterface $request): ResponseInterface
}
$resultJson = $funcResult->serializeToJsonString();

return new Response(200, ['content-type' => 'application/cloudevents+json'], $resultJson);
return new Response(200, ['content-type' => 'application/json'], $resultJson);
}
}
1 change: 1 addition & 0 deletions tests/TypedFunctionWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function (IntValue $foo): IntValue {
$request = new ServerRequest('POST', '/', ['content-type' => 'application/json'], '1');
$response = $typedFunctionWrapper->execute($request);
$this->assertSame('2', (string) $response->getBody());
$this->assertSame('application/json', $response->getHeaderLine("Content-Type"));
}

public function testBadRequest(): void
Expand Down

0 comments on commit 2a99824

Please sign in to comment.