Skip to content

Commit 39a0fa7

Browse files
fairkingManweill
authored andcommitted
Add support to x-www-form-urlencoded content type
1 parent 55e5879 commit 39a0fa7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/requestCodegen/getContentType.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { IRequestMethod } from '../swaggerInterfaces'
22

33
export function getContentType(reqProps: IRequestMethod, isV3: boolean) {
44
if (isV3) {
5-
return reqProps?.requestBody?.content['multipart/form-data'] ? 'multipart/form-data' : 'application/json'
5+
if (reqProps?.requestBody?.content['multipart/form-data']) {
6+
return 'multipart/form-data'
7+
} else if (reqProps?.requestBody?.content['application/x-www-form-urlencoded']) {
8+
return 'application/x-www-form-urlencoded'
9+
} else {
10+
return 'application/json'
11+
}
612
}
713

814
return reqProps.consumes && reqProps.consumes.includes('multipart/form-data')

0 commit comments

Comments
 (0)