Swap-Aggregator-Subgraph/node_modules/iso-stream-http/index.browser.js
Richa-iitr d211083153 Revert "Revert "added handler""
This reverts commit c36ee8c5ca.
2022-07-03 07:30:05 +05:30

21 lines
494 B
JavaScript

const http = require('./lib/http')
const https = http
const URL = self.URL
module.exports = {
http,
https,
getRequest: (options, cb) => {
let protocol = 'http:'
if (typeof options === 'string') {
const url = new URL(options)
protocol = url.protocol
} else if (options.protocol) {
protocol = options.protocol
}
return protocol === 'http:' ? http.request(options, cb) : https.request(options, cb)
}
}