Skip to content

201 Created is not obligated to return created objects in body #40399

@oozing-blade

Description

@oozing-blade

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/201

What specific section or headline is this issue about?

201 Created

What information was incorrect, unhelpful, or incomplete?

As long as I'm taking https://www.rfc-editor.org/rfc/rfc9110.html#name-201-created as definitive reference for status code.

15.3.2. 201 Created
The 201 (Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created. The primary resource created by the request is identified by either a Location header field in the response or, if no Location header field is received, by the target URI.

The 201 response content typically describes and links to the resource(s) created. Any validator fields (Section 8.8) sent in the response convey the current validators for a new representation created by the request. Note that the PUT method (Section 9.3.4) has additional requirements that might preclude sending such validators.

Important is phrase: "The 201 response content typically describes and links to the resource(s) created.".

MDN states

The newly-created items are returned in the body of the message,

But as per RFC, response is not obligated to carry created object. By description it could be meant ETag for instance.

What did you expect to see?

The newly-created items can be returned in the body of the message, but must be locatable by the URL of the initial request or by the URL in the value of the Location header provided with the response.

Do you have any supporting links, references, or citations?

https://www.rfc-editor.org/rfc/rfc9110.html#name-201-created

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:HTTPHTTP docsaccepting PRFeel free to open a PR to resolve this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions