Skip to content

Commit

Permalink
return proper response code
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala authored Dec 22, 2023
1 parent ecbf568 commit ef64c4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extensions/IntrospectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ public function types(HTTPRequest $request)
$manager = $this->owner->getManager();
} catch (Exception $ex) {
$message = $ex->getMessage();
if ($message == "Authentication required" || $message == "Not authorised") {
if ($message == "Authentication required") {
return (new HTTPResponse(json_encode(["error" => $message]), 401))
->addHeader('Content-Type', 'application/json');
}
if ($message == "Not authorised") {
return (new HTTPResponse(json_encode(["error" => $message]), 403))
->addHeader('Content-Type', 'application/json');
}
throw $ex;
}

Expand Down

0 comments on commit ef64c4f

Please sign in to comment.