-
Notifications
You must be signed in to change notification settings - Fork 226
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 operation with no input #2322
Conversation
output: TestNoPayloadInputOutput | ||
} | ||
|
||
apply TestNoInputNoPayload @httpRequestTests([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already the RestJsonNoInputAndOutput test, to which we can add the forbidHeaders
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, that operation is POST
, when it defines no input shape. That probably shouldn't build, or at least a warning should be emitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, it's better to add a new test here, as the goal of this test is to specifically verify that the content-type header doesn't get set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key distinction between POST
and GET
is idempotency rather than the presence of a body. I'm pretty sure we have APIs today that are POST
but bind their parameters to the URI/Headers. I'd agree with Hayden this is reasonable to add as a new test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure we have APIs today that are POST but bind their parameters to the URI/Headers
Yeah that's fine because you're sending over data. But when the definition of the operation is such that no data could ever be sent, POST usage is probably a modeling mistake on behalf of the user.
output: TestNoPayloadInputOutput | ||
} | ||
|
||
apply TestNoInputNoPayload @httpRequestTests([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key distinction between POST
and GET
is idempotency rather than the presence of a body. I'm pretty sure we have APIs today that are POST
but bind their parameters to the URI/Headers. I'd agree with Hayden this is reasonable to add as a new test.
Background
Testing
Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.