Skip to content

Commit

Permalink
Fix HTTP return type for unsupported version
Browse files Browse the repository at this point in the history
  • Loading branch information
driusan committed Jun 14, 2023
1 parent 033cc6a commit 5b8a7fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/api/php/endpoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ abstract class Endpoint extends LORISEndpoint implements RequestHandlerInterface
$versions = $this->supportedVersions() ?? [];
$version = $request->getAttribute("LORIS-API-Version") ?? "unknown";
if (!in_array($version, $versions)) {
return new \LORIS\Http\Response\JSON\BadRequest('Unsupported version');
// If it's not supported by a version of the API, that means the
// endpoint for that version should be not found
return new \LORIS\Http\Response\JSON\NotFound('Unsupported version']);
}

return parent::process($request, $handler);
Expand Down

0 comments on commit 5b8a7fc

Please sign in to comment.