Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make httpResponseCode be coupled with required #1098

Closed
david-perez opened this issue Feb 18, 2022 · 3 comments · Fixed by #1111
Closed

Make httpResponseCode be coupled with required #1098

david-perez opened this issue Feb 18, 2022 · 3 comments · Fixed by #1111

Comments

@david-perez
Copy link
Contributor

Currently, this is valid (taken from the restJson1 protocol tests):

@idempotent
@http(uri: "/HttpResponseCode", method: "PUT")
operation HttpResponseCode {
    output: HttpResponseCodeOutput
}

structure HttpResponseCodeOutput {
    @httpResponseCode
    Status: Integer
}

How should a server behave when Status is not provided? The spec does not mention. Should it fall back to 200? In our Rust sSDK implementation, we are currently failing to serialize the response.

I think httpResponseCode without required should not be allowed, since status code cannot be omitted from the HTTP response as per the RFC.

@JordonPhillips
Copy link
Contributor

JordonPhillips commented Feb 25, 2022

How should a server behave when Status is not provided?

You use whatever is set on the http trait. I'll double check existing implementations.

@jjant
Copy link
Contributor

jjant commented Oct 27, 2022

@kstich @JordonPhillips regarding the RestJsonHttpResponseCodeDefaultsToModeledCode test, isn't the code missing in the operation's @http trait?

@kstich
Copy link
Contributor

kstich commented Oct 31, 2022

The code value of the @http trait defaults to 200 if not provided

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 a pull request may close this issue.

4 participants