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 media type x-www-form-urlencoded #161

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lfanselau
Copy link

Should fix the problems in #160. Not sure about the side effects, that this has though, for my OpenAPI file it works fine though^^

@@ -50,6 +50,11 @@ export const getRequestBodyType = ({
return f.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword);
}

// NOTE: Maybe not perfect to have this hardcoded here
if (mediaType.contentType === "application/x-www-form-urlencoded") {
return f.createTypeReferenceNode("URLSearchParams", undefined);
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add some unit test about this change?

Copy link
Author

Choose a reason for hiding this comment

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

Sure thing, If would add it to getOperationTypes.test.ts right? What kind of test runner are you using?

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

For the location of the test, I let you decide where this makes sense. The idea is to be sure this will not be broken later and to see that this is working as expected 😃

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 this pull request may close these issues.

2 participants