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

Add restJson1 protocol test for content-type and POST operation with no input #2342

Merged
merged 5 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,41 @@ structure TestNoPayloadInputOutput {
///
@readonly
@http(uri: "/no_input_no_payload", method: "GET")
operation TestNoInputNoPayload {
operation TestGetNoInputNoPayload {
output: TestNoPayloadInputOutput
}

apply TestNoInputNoPayload @httpRequestTests([
@readonly
haydenbaker marked this conversation as resolved.
Show resolved Hide resolved
@http(uri: "/no_input_no_payload", method: "POST")
operation TestPostNoInputNoPayload {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say add TestPostNoPayload (similar to TestNoPayload but with POST) also. That would actually more closely represent the issue represented in the .NET issue.

output: TestNoPayloadInputOutput
}

apply TestGetNoInputNoPayload @httpRequestTests([
{
id: "RestJsonHttpWithNoInput",
id: "RestJsonHttpGetWithNoInput",
documentation: "Serializes a GET request for an operation with no input, and therefore no modeled body",
protocol: restJson1,
method: "GET",
uri: "/no_input_no_payload",
body: "",
forbidHeaders: [
"Content-Length",
"Content-Type",
"Content-Length"
],
params: {}
}
])

apply TestPostNoInputNoPayload @httpRequestTests([
{
id: "RestJsonHttpPostWithNoInput",
documentation: "Serializes a POST request for an operation with no input, and therefore no modeled body",
protocol: restJson1,
method: "POST",
uri: "/no_input_no_payload",
body: "",
forbidHeaders: [
"Content-Type"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like missed Content-Length here

Copy link
Contributor Author

@haydenbaker haydenbaker Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clients SHOULD include Content-Length: 0 on a POST without no body, hence not including Content-Length in forbidHeaders here: https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2

],
params: {}
Expand Down
Loading