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
31 lines
493 B
JavaScript
31 lines
493 B
JavaScript
function makeWindow() {
|
|
var win = {
|
|
location: {},
|
|
history: {},
|
|
open: () => {},
|
|
close: () => {},
|
|
File: function() {},
|
|
FormData: 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
|
|
}
|
|
|
|
export default makeWindow()
|