Skip to content

Should 304/412 response take preference over 404? #191

Open
@michielbdejong

Description

As reported via email by Walson Low:

section 5 of draft-22 [...] states:
...
404 for all DELETE, GET and HEAD requests to documents that do not exist on the storage
412 for a conditional PUT or DELETE request whose precondition fails (see "Versioning" below)
...

How should the storage respond to PUT requests with an "If-Match" header for documents that do not exist on the storage? The clients, in this case, expect the document to exist (due to the "If-Match" header), but the document has been removed from storage.
For DELETE requests with an "If-Match" header, the storage responds with a 404 status code if the document does not exist.
Should the storage respond with a 404 or 412 status code for PUT requests with an "If-Match" header for documents that do not exist? I believe it would be consistent to respond with a 404, similar to the behavior for DELETE requests.

My answer:

My intuition would be that 412 takes preference over 404, but I don't have a good reason for it.
I guess it would require less code on the client because they already have to handle 412 anyway, for the case where the resource does exist but has a different ETag.

Maybe we should change that first line to say "404 for all unconditional DELETE, GET and HEAD requests to documents that do not exist on the storage"?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions