When an ObjNotFoundError is raised by an objstorage RPC endpoint
implementation, ensure that a 404 HTTP status code will be returned
for consistency.
Previously, a 400 HTTP status code was returned.
Depends on D8227
Differential D8228
api/server: Ensure to return a 404 status code for not found object anlambert on Aug 9 2022, 7:00 PM. Authored by
Details
Diff Detail
Event TimelineComment Actions Build has FAILED Patch application report for D8228 (id=29676)Rebasing onto 2e642be3ec... Current branch diff-target is up to date. Changes applied before testcommit 444fdb8dd853c85c576093b4652da082fcbcd8a6 Author: Antoine Lambert <anlambert@softwareheritage.org> Date: Tue Aug 9 18:51:43 2022 +0200 api/server: Ensure to return a 404 status code for not found object When an ObjNotFoundError is raised by an objstorage RPC endpoint implementation, ensure that a 404 HTTP status code will be returned for consistency. Previously, a 400 HTTP status code was returned. Link to build: https://jenkins.softwareheritage.org/job/DOBJS/job/tests-on-diff/174/ Comment Actions
Consistency with what? None of the RPC servers uses 404 status codes to represent missing objects Comment Actions With HTTP protocol, it makes sense to return a 404 status code in the objstorage context imho. Comment Actions The RPC protocol does not use specific HTTP status codes just for the sake of following HTTP status codes; and it complicates handling on the server side. For the same reason, we don't use 204 on methods returning None, 403 or 201 in _add endpoints, 409 on hash collisions, etc. |