Skip to content

Commit 2ca9958

Browse files
fairkingManweill
authored andcommitted
Prefer_Json_over_other_content_types (prefer 'form-data' over json)
1 parent 519dd75 commit 2ca9958

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/requestCodegen/getContentType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ export function getContentType(reqProps: IRequestMethod, isV3: boolean) {
55
if (reqProps?.requestBody?.content) {
66
const ct_keys = Object.keys(reqProps?.requestBody?.content)
77
if (ct_keys.length > 0) {
8-
return ct_keys[0]
8+
return ct_keys.includes('multipart/form-data') ? 'multipart/form-data' : ct_keys[0]
99
}
1010
}
1111
return 'application/json'
1212
} else {
1313
if (reqProps?.consumes && reqProps?.consumes.length > 0) {
14-
return reqProps?.consumes[0]
14+
return reqProps.consumes.includes('multipart/form-data') ? 'multipart/form-data' : reqProps.consumes[0]
1515
}
1616
return 'application/json'
1717
}

0 commit comments

Comments
 (0)