Skip to content

Commit

Permalink
Adds json header for api-docs documentation response
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobemerick committed Oct 31, 2016
1 parent 53c283a commit ceff268
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __invoke(Request $request, Response $response, callable $next)
}

$response = $response->withStatus(200);
// todo header
$response = $response->withHeader('Content-type', 'application/json');
$response->getBody()->write($swaggerDoc);
return $response;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/src/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public function testInvokationDocumentationRouteReturnsSwagger()
->method('withStatus')
->with(200)
->will($this->returnSelf());
$mockResponse->expects($this->once())
->method('withHeader')
->with('Content-type', 'application/json')
->will($this->returnSelf());
$mockResponse->expects($this->once())
->method('getBody')
->willReturn($mockBody);
Expand Down

0 comments on commit ceff268

Please sign in to comment.