Skip to content

Commit

Permalink
Merge pull request #133 from bearsunday/hotfix
Browse files Browse the repository at this point in the history
Set proper headers
  • Loading branch information
koriym authored Aug 8, 2019
2 parents bda7248 + 844cf46 commit 7bf17bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Provide/Transfer/HttpResponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function __invoke(ResourceObject $ro, array $server)

private function getOutput(ResourceObject $ro, array $server) : Output
{
$ro->toString(); // render and set headers
return new Output($ro->code, ($this->header)($ro, $server), $ro->view ?: $ro->toString());
}
}
3 changes: 3 additions & 0 deletions tests/Provide/Transfer/HttpResponderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testTransfer()
$ro->transfer($this->responder, []);
$expectedArgs = [
['Cache-Control: max-age=0', false],
['Content-Type: application/json', false],
];
$actual = FakeHttpResponder::$headers;
$this->assertSame($expectedArgs, $actual);
Expand All @@ -48,6 +49,7 @@ public function __toString()
$expectedArgs = [
['Cache-Control: max-age=0', false],
['Foo: foo-string', false],
['Content-Type: application/json', false],
];
$this->assertSame($expectedArgs, FakeHttpResponder::$headers);
$expect = '{"greeting":"hello world"}';
Expand Down Expand Up @@ -79,6 +81,7 @@ public function testTransferETagIsNotMatch()
$expectedArgs = [
['Cache-Control: max-age=0', false],
['ETag: etag-y', false],
['Content-Type: application/json', false],
];

$this->assertSame($expectedArgs, FakeHttpResponder::$headers);
Expand Down

0 comments on commit 7bf17bf

Please sign in to comment.