Skip to content

Commit

Permalink
Clarify defaulting behavior of response code binding
Browse files Browse the repository at this point in the history
JordonPhillips authored and kstich committed Mar 2, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a80fc6e commit 489c410
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/source/1.0/spec/core/http-traits.rst
Original file line number Diff line number Diff line change
@@ -1145,7 +1145,8 @@ Conflicts with

Marking an output ``structure`` member with this trait can be used to provide
different response codes for an operation, like a 200 or 201 for a PUT
operation.
operation. If this member isn't provided, server implementations MUST default
to the `code` set by the :ref:`http-trait`.

.. rubric:: ``httpResponseCode`` is only used on output

Original file line number Diff line number Diff line change
@@ -39,6 +39,25 @@ apply HttpResponseCode @httpResponseTests([
Status: 201,
}
},
{
id: "RestJsonHttpResponseCodeDefaultsToModeledCode",
documentation: """
Binds the http response code to the http trait's code if the
code isn't explicitly set. A client would be parsing the
http response code, so this would always be present, but
a server doesn't require it to be set to serialize a request.""",
protocol: restJson1,
code: 200,
headers: {
"Content-Type": "application/json",
},
body: "{}",
bodyMediaType: "application/json",
// A client would parse the http response code, and so for clients it
// will always be present, but a server doesn't require it to be set.
params: {},
appliesTo: "server"
},
{
id: "RestJsonHttpResponseCodeWithNoPayload",
documentation: """

0 comments on commit 489c410

Please sign in to comment.