@interopio/gateway-server
Version:
[](https://www.npmjs.com/package/@interopio/gateway-server)
3 lines (2 loc) • 739 B
JavaScript
import*as i from"@interopio/gateway/metrics/publisher/rest";import{CookieAgent as a}from"http-cookie-agent/undici/v6";import{CookieAgent as f}from"http-cookie-agent/undici";import{CookieJar as p}from"tough-cookie";async function m(e){let t=process.version,o=Number(t.substring(1,t.indexOf(".")));if(o>=18&&o<24)return new a({cookies:{jar:e}});{let{interceptors:r}=await import("undici");return new f({cookies:{jar:e}}).compose(r.redirect())}}var g=async e=>{let t=e??globalThis.fetch,o=new p,n=await m(o);return async(r,s)=>{let c={...s,dispatcher:n};return await t(r,c)}},w=i.name;async function y(e,t){return i.create({...e,fetch:await g(e.fetch)},t)}export{y as create,g as fetchWithCookies,w as name};
//# sourceMappingURL=rest.js.map