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"
30 lines
465 B
JavaScript
30 lines
465 B
JavaScript
function makeWindow() {
|
|
var win = {
|
|
location: {},
|
|
history: {},
|
|
open: () => {},
|
|
close: () => {},
|
|
File: function() {}
|
|
}
|
|
|
|
if(typeof window === "undefined") {
|
|
return win
|
|
}
|
|
|
|
try {
|
|
win = window
|
|
var props = ["File", "Blob", "FormData"]
|
|
for (var prop of props) {
|
|
if (prop in window) {
|
|
win[prop] = window[prop]
|
|
}
|
|
}
|
|
} catch( e ) {
|
|
console.error(e)
|
|
}
|
|
|
|
return win
|
|
}
|
|
|
|
module.exports = makeWindow()
|