Fix #2922: file uploads fail to render curl command
The request body is an immutable.js OrderedMap rather than a string, so this fixes the type error: TypeError: request.get(...).split is not a function Adds a special curl command argument for files, e.g. curl -F "param=value" -F "file=@filename.txt;type=text/plain"
This commit is contained in:
@@ -7,6 +7,7 @@ import _memoize from "lodash/memoize"
|
||||
import some from "lodash/some"
|
||||
import eq from "lodash/eq"
|
||||
import { memoizedSampleFromSchema, memoizedCreateXMLExample } from "core/plugins/samples/fn"
|
||||
import win from "./window"
|
||||
|
||||
const DEFAULT_REPONSE_KEY = "default"
|
||||
|
||||
@@ -34,6 +35,9 @@ export function fromJSOrdered (js) {
|
||||
if(isImmutable(js))
|
||||
return js // Can't do much here
|
||||
|
||||
if (js instanceof win.File)
|
||||
return js
|
||||
|
||||
return !isObject(js) ? js :
|
||||
Array.isArray(js) ?
|
||||
Im.Seq(js).map(fromJSOrdered).toList() :
|
||||
|
||||
Reference in New Issue
Block a user