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

[Feature] [SwaggerV2] Body Parameter affect content-type header and implement formData type #1722

Merged
merged 4 commits into from Nov 22, 2019

Conversation

@beardeddragon5
Copy link
Contributor

beardeddragon5 commented Oct 11, 2019

Swagger parameter that write to body affect the 'Content-Type' header send by the client. Insomnia didn't add this header.

Insomnia did only support json body parameters. I added formData (x-www-form-urlencoded, multipart/form-data) support and generation of examples.

@beardeddragon5 beardeddragon5 changed the title Body Parameter affect content-type header and implement formData type [Feature] [SwaggerV2] Body Parameter affect content-type header and implement formData type Oct 11, 2019
Copy link
Contributor

gschier left a comment

Awesome work on this! Just one question about test fixtures.

@@ -170,6 +172,16 @@ function importRequest(endpointSchema, globalMimeTypes, id, parentId) {
headers: prepareHeaders(endpointSchema),
parameters: prepareQueryParams(endpointSchema),
};
if (request.body.mimeType && !request.headers.find(header => header.name === 'Content-Type')) {

This comment has been minimized.

Copy link
@gschier

gschier Oct 31, 2019

Contributor

Nice! I love this solution

return {
mimeType: supportedMimeType,
};
return {};

This comment has been minimized.

Copy link
@gschier

gschier Oct 31, 2019

Contributor

Nice cleanup here 💯

"disabled": false,
"value": "multipart/form-data"
}
],

This comment has been minimized.

Copy link
@gschier

gschier Oct 31, 2019

Contributor

Should this also have added parameters to the body attribute of the request? I don't see any request bodies for this change reflected in the tests.

This comment has been minimized.

Copy link
@beardeddragon5

beardeddragon5 Nov 4, 2019

Author Contributor

Could be, as i pointed out in the other pull requests. The tests always returned passed. I might missed this while writing the fixtures.

@beardeddragon5

This comment has been minimized.

Copy link
Contributor Author

beardeddragon5 commented Nov 10, 2019

I updated the fixtures

@beardeddragon5 beardeddragon5 requested a review from gschier Nov 10, 2019
Copy link
Contributor

gschier left a comment

Awesome, looks great! 🙌🏻🎊

@gschier gschier merged commit ab990d7 into Kong:develop Nov 22, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.