feat: respect Encoding Object while building requests (#9105)
This change fixes both: 1. making multipart/form-data requests with content-type header for every individual boundary 2. generating correct CURL command for multipart/form-data request, allowing specifying content-type header for every individual boundary Refs #4826 Refs #5356
This commit is contained in:
@@ -111,7 +111,18 @@ const curlify = (request, escape, newLine, ext = "") => {
|
||||
addNewLine()
|
||||
addIndent()
|
||||
addWordsWithoutLeadingSpace("-F")
|
||||
if (v instanceof win.File) {
|
||||
|
||||
/**
|
||||
* SwaggerClient produces specialized sub-class of File class, that only
|
||||
* accepts string data and retain this data in `data`
|
||||
* public property throughout the lifecycle of its instances.
|
||||
*
|
||||
* This sub-class is exclusively used only when Encoding Object
|
||||
* is defined within the Media Type Object (OpenAPI 3.x.y).
|
||||
*/
|
||||
if (v instanceof win.File && typeof v.valueOf() === "string") {
|
||||
addWords(`${extractedKey}=${v.data}${v.type ? `;type=${v.type}` : ""}`)
|
||||
} else if (v instanceof win.File) {
|
||||
addWords(`${extractedKey}=@${v.name}${v.type ? `;type=${v.type}` : ""}`)
|
||||
} else {
|
||||
addWords(`${extractedKey}=${v}`)
|
||||
|
||||
Reference in New Issue
Block a user