fix: only append type flag to curl if type is defined (via #5041)

* issue 5040: only append type to formData file if defined

* errant whitespace removal:

* conform to code style

* code style

* use template string in nested type ternary operator
This commit is contained in:
Kristofer Wright
2018-11-23 15:22:42 -08:00
committed by kyle
parent 88e2c9af54
commit a40edea3f1
2 changed files with 21 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ export default function curl( request ){
for( let [ k,v ] of request.get("body").entrySeq()) {
curlified.push( "-F" )
if (v instanceof win.File) {
curlified.push( `"${k}=@${v.name};type=${v.type}"` )
curlified.push( `"${k}=@${v.name}${v.type ? `;type=${v.type}` : ""}"` )
} else {
curlified.push( `"${k}=${v}"` )
}