You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
624 B
23 lines
624 B
4 months ago
|
const nodeFetch = require('node-fetch')
|
||
|
const realFetch = nodeFetch.default || nodeFetch
|
||
|
|
||
|
const fetch = function (url, options) {
|
||
|
// Support schemaless URIs on the server for parity with the browser.
|
||
|
// Ex: //github.com/ -> https://github.com/
|
||
|
if (/^\/\//.test(url)) {
|
||
|
url = 'https:' + url
|
||
|
}
|
||
|
return realFetch.call(this, url, options)
|
||
|
}
|
||
|
|
||
|
fetch.ponyfill = true
|
||
|
|
||
|
module.exports = exports = fetch
|
||
|
exports.fetch = fetch
|
||
|
exports.Headers = nodeFetch.Headers
|
||
|
exports.Request = nodeFetch.Request
|
||
|
exports.Response = nodeFetch.Response
|
||
|
|
||
|
// Needed for TypeScript consumers without esModuleInterop.
|
||
|
exports.default = fetch
|