Skip to content

Commit

Permalink
fix apikey auth middleware (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararok authored Dec 10, 2019
1 parent 7f70b77 commit 0a9382b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/SAREhub/Microt/App/Auth/ApiKey/ApiKeyAuthMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function __invoke(Request $request, Response $response, callable $next)
if ($request->getQueryParam(self::QP_APIKEY, "") !== $this->apiKey) {
return JsonResponse::wrap($response)->error("Invalid apiKey", [], 401);
}
$next($request, $response);

return $next($request, $response);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ public function testInvokeWhenPassed()
$response = HttpHelper::response();
$next = CallableMock::create();

$next->expects("__invoke")->with($request, $response);
$expectedResponse = HttpHelper::response();
$next->expects("__invoke")->with($request, $response)->andReturn($expectedResponse);

($this->middleware)($request, $response, $next);
$currentResponse = ($this->middleware)($request, $response, $next);
$this->assertSame($expectedResponse, $currentResponse);
}

public function testInvokeWhenNotPassed()
Expand Down

0 comments on commit 0a9382b

Please sign in to comment.