-
Notifications
You must be signed in to change notification settings - Fork 764
Issue 995 #1016
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
Issue 995 #1016
Conversation
ponelat
left a comment
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.
one more test, please
test/execute.js
Outdated
| }) | ||
| }) | ||
|
|
||
| it('should not add content-type with no form-data or body param', function () { |
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.
should not? I see content-type lower down
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 would like to see a test, where no contentType is added. As one of our current issues, is that GET requests get a content-type: application/json. And I'd like to make sure that doesn't happen in swagger-js ( I'm pretty sure it doesn't, but still ).
| }) | ||
|
|
||
| it('should handle requestContentType', function () { | ||
| it('should not add content-type with no form-data or body param', function () { |
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.
@ponelat this test is about not to set content type
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.
ok... but this test includes a requestContentType. If that is present, it should always set the header.
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.
With the issue in swagger-api/swagger-ui#2909, there is likely a requestContentType being passing in from swagger-ui. And that shouldn't happen
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.
Here https://github.com/swagger-api/swagger-js/pull/1016/files#diff-2932c1430f43e1d22b8cf8b98fa5d2a8R127 first we check if there is body or form and only after that - if there is content-type passed from UI
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 see that. But we shouldn't 😛 if there is a requestContentType we must use it. Its an override provided by the user ( or swagger-ui in our case ).
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.
you're right @bodnia it does only make sense if there is a body. The user can override the content-type header in other ways, if need be IIRC.
|
@ponelat merge? |
No description provided.