Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const crossFetch = require('cross-fetch')
global.fetch = crossFetch
global.Response = crossFetch.Response
global.Headers = crossFetch.Headers
global.Request = crossFetch.Request
if (!Promise) {
Promise = require('promise-polyfill')
} else if (!Promise.finally) {
Promise.finally = require('promise-polyfill').finally
}
const ActualResponse = Response
function responseWrapper(body, init) {
if (
body &&
typeof body.constructor === 'function' &&
body.constructor.__isFallback
) {
const response = new ActualResponse(null, init)
response.body = body
const actualClone = response.clone
response.clone = () => {
const crossFetch = require('cross-fetch')
global.fetch = crossFetch
global.Response = crossFetch.Response
global.Headers = crossFetch.Headers
global.Request = crossFetch.Request
if (!Promise) {
Promise = require('promise-polyfill')
} else if (!Promise.finally) {
Promise.finally = require('promise-polyfill').finally
}
const ActualResponse = Response
function responseWrapper(body, init) {
if (
body &&
typeof body.constructor === 'function' &&
body.constructor.__isFallback
) {
const response = new ActualResponse(null, init)
response.body = body
const actualClone = response.clone
response.clone = () => {
const clone = actualClone.call(response)