Skip to content

Both 404 and 412 should be correct status codes for delete | If-Match header | returns 412 if does not exist #4

@DougReeder

Description

@DougReeder

https://github.com/remotestorage/spec/blob/main/release/draft-dejong-remotestorage-26.txt non-normatively says on line 348

404 for all DELETE, GET and HEAD requests to documents that do not exist on the storage,

and on line 361 it says non-normatively

412 for a conditional PUT or DELETE request whose precondition fails (see "Versioning" below),

and on line 894 it says normatively for DELETE request

And the server may respond with a 412 Precondition Failed or a 200 OK status: [emphasis mine]

So, while the spec appears to favor 412 over 404 for conditionally deleting a file that doesn't exist, it doesn't actually require 412.

Regardless of the spec, both 404 and 412 are logically correct (the document doesn't exist, and it doesn't have an ETag that matches the specified one) and allowing both is more expressive: On a 404, a client knows that the server is already in the desired state, whereas on a 412 it might think it needs to retrieve the document and check for new content.

Metadata

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