blob: d63ff10cdeb131d25b1221d75202eeb78c730187 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
function makeProxy(fetch) {
return new Proxy(fetch, {
get(target, prop) {
const p = target[prop];
if (typeof p === 'function') {
return (url, options = {}) =>
p.call(target, url, Object.assign(options, { version: global.HTTP_VERSION }));
}
return p;
},
});
}
exports.Snekfetch = makeProxy(require('../'));
try {
exports.SnekfetchSync = makeProxy(require('../sync'));
} catch (err) {} // eslint-disable-line no-empty
exports.TestRoot = global.HTTP_VERSION === 2 ?
'https://nghttp2.org/httpbin' :
'https://httpbin.org';
|