Skip to content

ref(server): Use "correct" methods and status codes for creation#215

Merged
jan-auer merged 5 commits intomainfrom
ref/put-status-codes
Nov 19, 2025
Merged

ref(server): Use "correct" methods and status codes for creation#215
jan-auer merged 5 commits intomainfrom
ref/put-status-codes

Conversation

@jan-auer
Copy link
Member

@jan-auer jan-auer commented Nov 19, 2025

Creating an object with or without a key usually uses different HTTP
verbs. PUT writes or overrides an object at a known key, while POST
always adds a new object with a server-defined key. The status codes
also differ, with POST returning 201 CREATED.

If we think this is useful, we could also make PUT return 201, but for
that we'd have to return from the backend whether the object previously
existed.

Internally, we now have two types:

  • ObjectPath requires a key to be present. It is used for GET and
    DELETE.
  • OptionalObjectPath has an optional key. It can be converted into
    ObjectPath, either requiring or creating a random key.

ObjectPath deserializes via OptionalObjectPath.

@jan-auer jan-auer requested a review from a team as a code owner November 19, 2025 14:41
@jan-auer jan-auer force-pushed the ref/put-status-codes branch from 5e25d22 to 2d6f579 Compare November 19, 2025 15:19
@jan-auer jan-auer enabled auto-merge (squash) November 19, 2025 15:21
@jan-auer jan-auer merged commit 96c9f32 into main Nov 19, 2025
15 checks passed
@jan-auer jan-auer deleted the ref/put-status-codes branch November 19, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments