Skip to content

Commit

Permalink
direct return on response->withHeader()
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Mar 21, 2018
1 parent 0f6c895 commit b9882d6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Middleware/ForceHttps.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ private function setHttpStrictTransportSecurity($uriScheme, RouteResult $match,
}

if ($this->config['strict_transport_security']['enable'] === true) {
$response = $response->withHeader('Strict-Transport-Security', $this->config['strict_transport_security']['value']);
return $response;
return $response->withHeader('Strict-Transport-Security', $this->config['strict_transport_security']['value']);
}

$response = $response->withHeader('Strict-Transport-Security', 'max-age=0');
return $response;
return $response->withHeader('Strict-Transport-Security', 'max-age=0');
}

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Expand Down Expand Up @@ -82,8 +80,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

// 308 keeps headers, request method, and request body
$response = $response->withStatus(308);
$response = $response->withHeader('Location', $httpsRequestUri);

return $response;
return $response->withHeader('Location', $httpsRequestUri);
}
}

0 comments on commit b9882d6

Please sign in to comment.