Files
swagger-ui/src/core/window.js
Vladimír Gorej b2814737d6 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
2023-08-01 15:20:22 +02:00

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()