Skip to content

Commit

Permalink
Changing the security middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Apr 4, 2017
1 parent bc2495a commit 3f61fcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Routing/Middleware/SecurityMiddleware.php
Expand Up @@ -170,11 +170,10 @@ protected function checkValues($value, array $allowed)
{
if (!in_array($value, $allowed)) {
throw new InvalidArgumentException(sprintf(
'Invalid arg `%s`, use one of these: %s',
$value,
implode(', ', $allowed)
)
);
'Invalid arg `%s`, use one of these: %s',
$value,
implode(', ', $allowed)
));
}
}

Expand All @@ -188,10 +187,11 @@ protected function checkValues($value, array $allowed)
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
{
$response = $next($request, $response);
foreach ($this->headers as $header => $value) {
$response = $response->withHeader($header, $value);
}

return $next($request, $response);
return $response;
}
}
3 changes: 2 additions & 1 deletion tests/TestCase/Routing/Middleware/SecurityMiddlewareTest.php
Expand Up @@ -22,7 +22,8 @@
/**
* Test for SecurityMiddleware
*/
class SecurityMiddlewareTest extends TestCase {
class SecurityMiddlewareTest extends TestCase
{

/**
* Test adding the security headers
Expand Down

0 comments on commit 3f61fcf

Please sign in to comment.