Skip to content

Commit

Permalink
Merge pull request #25 from chadicus/bug/content-type
Browse files Browse the repository at this point in the history
Ensure text/html content type when rendering views
  • Loading branch information
chadicus committed May 22, 2016
2 parents f5188d7 + 2f1c264 commit 0d9a163
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res
if (empty($authorized)) {
$response = Http\ResponseBridge::fromOAuth2($oauth2Response);
$this->view->render($response, $this->template, ['client_id' => $oauth2Request->query('client_id', false)]);
return $response;
return $response->withHeader('Content-Type', 'text/html');
}

$this->server->handleAuthorizeRequest($oauth2Request, $oauth2Response, $authorized === 'yes');
Expand Down
2 changes: 1 addition & 1 deletion src/ReceiveCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ public function __construct($view, $template = '/receive-code.phtml')
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $arguments = [])
{
$this->view->render($response, $this->template, ['code' => $request->getParam('code')]);
return $response;
return $response->withHeader('Content-Type', 'text/html');
}
}
1 change: 1 addition & 0 deletions tests/AuthorizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function invokeEmptyAuthorized()

$expected = <<<HTML
HTTP/1.1 200 OK
Content-Type: text/html
<form method="post">
<label>Do You Authorize testClientId?</label><br />
Expand Down
1 change: 1 addition & 0 deletions tests/ReceiveCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function invoke()

$expected = <<<HTML
HTTP/1.1 200 OK
Content-Type: text/html
<h2>The authorization code is {$code}</h2>
Expand Down

0 comments on commit 0d9a163

Please sign in to comment.