mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
21 lines
494 B
JavaScript
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)
|
|
}
|
|
}
|