🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

node-mock-http

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mock-http - npm Package Compare versions

Comparing version
1.0.4
to
1.0.5
+1
-1
dist/_polyfill/events/nodeless.cjs

@@ -1,2 +0,2 @@

"use strict";let y=10;const Y=Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})()))),F=(e,t)=>e,g=Error,J=Error,h=Error,b=Error,Z=Error,R=Symbol.for("nodejs.rejection"),l=Symbol.for("kCapture"),A=Symbol.for("events.errorMonitor"),p=Symbol.for("shapeMode"),w=Symbol.for("events.maxEventTargetListeners"),ee=Symbol.for("kEnhanceStackBeforeInspector"),te=Symbol.for("nodejs.watermarkData"),E=Symbol.for("kAsyncResource"),ne=Symbol.for("kFirstEventParam"),N=Symbol.for("kResistStopPropagation"),W=Symbol.for("events.maxEventTargetListenersWarned");class EventEmitter{_events=void 0;_eventsCount=0;_maxListeners=y;[l]=!1;[p]=!1;static captureRejectionSymbol=R;static errorMonitor=A;static kMaxEventTargetListeners=w;static kMaxEventTargetListenersWarned=W;static usingDomains=!1;static get on(){return on}static get once(){return once}static get getEventListeners(){return getEventListeners}static get getMaxListeners(){return getMaxListeners}static get addAbortListener(){return addAbortListener}static get EventEmitterAsyncResource(){return EventEmitterAsyncResource}static get EventEmitter(){return EventEmitter}static setMaxListeners(t=y,...r){if(r.length===0)y=t;else for(const n of r)if($(n))n[w]=t,n[W]=!1;else if(typeof n.setMaxListeners=="function")n.setMaxListeners(t);else throw new h("eventTargets",["EventEmitter","EventTarget"],n)}static listenerCount(t,r){if(typeof t.listenerCount=="function")return t.listenerCount(r);EventEmitter.prototype.listenerCount.call(t,r)}static init(){throw new Error("EventEmitter.init() is not implemented.")}static get captureRejections(){return this[l]}static set captureRejections(t){this[l]=t}static get defaultMaxListeners(){return y}static set defaultMaxListeners(t){y=t}constructor(t){this._events===void 0||this._events===Object.getPrototypeOf(this)._events?(this._events={__proto__:null},this._eventsCount=0,this[p]=!1):this[p]=!0,this._maxListeners=this._maxListeners||void 0,t?.captureRejections?this[l]=!!t.captureRejections:this[l]=EventEmitter.prototype[l]}setMaxListeners(t){return this._maxListeners=t,this}getMaxListeners(){return S(this)}emit(t,...r){let n=t==="error";const s=this._events;if(s!==void 0)n&&s[A]!==void 0&&this.emit(A,...r),n=n&&s.error===void 0;else if(!n)return!1;if(n){let i;if(r.length>0&&(i=r[0]),i instanceof Error){try{const f={};Error.captureStackTrace?.(f,EventEmitter.prototype.emit),Object.defineProperty(i,ee,{__proto__:null,value:Function.prototype.bind(re,this,i,f),configurable:!0})}catch{}throw i}let u;try{u=F(i)}catch{u=i}const a=new J(u);throw a.context=i,a}const o=s[t];if(o===void 0)return!1;if(typeof o=="function"){const i=o.apply(this,r);i!=null&&H(this,i,t,r)}else{const i=o.length,u=C(o);for(let a=0;a<i;++a){const f=u[a].apply(this,r);f!=null&&H(this,f,t,r)}}return!0}addListener(t,r){return z(this,t,r,!1),this}on(t,r){return this.addListener(t,r)}prependListener(t,r){return z(this,t,r,!0),this}once(t,r){return this.on(t,U(this,t,r)),this}prependOnceListener(t,r){return this.prependListener(t,U(this,t,r)),this}removeListener(t,r){const n=this._events;if(n===void 0)return this;const s=n[t];if(s===void 0)return this;if(s===r||s.listener===r)this._eventsCount-=1,this[p]?n[t]=void 0:this._eventsCount===0?this._events={__proto__:null}:(delete n[t],n.removeListener&&this.emit("removeListener",t,s.listener||r));else if(typeof s!="function"){let o=-1;for(let i=s.length-1;i>=0;i--)if(s[i]===r||s[i].listener===r){o=i;break}if(o<0)return this;o===0?s.shift():ce(s,o),s.length===1&&(n[t]=s[0]),n.removeListener!==void 0&&this.emit("removeListener",t,r)}return this}off(t,r){return this.removeListener(t,r)}removeAllListeners(t){const r=this._events;if(r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events={__proto__:null},this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events={__proto__:null}:delete r[t]),this[p]=!1,this;if(arguments.length===0){for(const s of Reflect.ownKeys(r))s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={__proto__:null},this._eventsCount=0,this[p]=!1,this}const n=r[t];if(typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(let s=n.length-1;s>=0;s--)this.removeListener(t,n[s]);return this}listeners(t){return G(this,t,!0)}rawListeners(t){return G(this,t,!1)}eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}listenerCount(t,r){const n=this._events;if(n!==void 0){const s=n[t];if(typeof s=="function")return r!=null?r===s||r===s.listener?1:0:1;if(s!==void 0){if(r!=null){let o=0;for(let i=0,u=s.length;i<u;i++)(s[i]===r||s[i].listener===r)&&o++;return o}return s.length}}return 0}}class EventEmitterAsyncResource extends EventEmitter{constructor(t){let r;typeof t=="string"?(r=t,t=void 0):r=t?.name||new.target.name,super(t),this[E]=new EventEmitterReferencingAsyncResource(this,r,t)}emit(t,...r){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");const{asyncResource:n}=this;return Array.prototype.unshift(r,super.emit,this,t),Reflect.apply(n.runInAsyncScope,n,r)}emitDestroy(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");this.asyncResource.emitDestroy()}get asyncId(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this.asyncResource.asyncId()}get triggerAsyncId(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this.asyncResource.triggerAsyncId()}get asyncResource(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this[E]}}const on=function(e,t,r={}){const n=r.signal;if(n?.aborted)throw new b(void 0,{cause:n?.reason});const s=r.highWaterMark??r.highWatermark??Number.MAX_SAFE_INTEGER,o=r.lowWaterMark??r.lowWatermark??1,i=new O,u=new O;let a=!1,f=null,v=!1,m=0;const I=Object.setPrototypeOf({next(){if(m){const c=i.shift();return m--,a&&m<o&&(e.resume?.(),a=!1),Promise.resolve(T(c,!1))}if(f){const c=Promise.reject(f);return f=null,c}return v?d():new Promise(function(c,V){u.push({resolve:c,reject:V})})},return(){return d()},throw(c){if(!c||!(c instanceof Error))throw new h("EventEmitter.AsyncIterator","Error",c);x(c)},[Symbol.asyncIterator](){return this},[te]:{get size(){return m},get low(){return o},get high(){return s},get isPaused(){return a}}},Y),{addEventListener:_,removeAll:K}=ue();_(e,t,r[ne]?j:function(...c){return j(c)}),t!=="error"&&typeof e.on=="function"&&_(e,"error",x);const k=r?.close;if(k?.length)for(const c of k)_(e,c,d);const q=n?addAbortListener(n,Q):null;return I;function Q(){x(new b(void 0,{cause:n?.reason}))}function j(c){u.isEmpty()?(m++,!a&&m>s&&(a=!0,e.pause?.()),i.push(c)):u.shift().resolve(T(c,!1))}function x(c){u.isEmpty()?f=c:u.shift().reject(c),d()}function d(){q?.[Symbol.dispose](),K(),v=!0;const c=T(void 0,!0);for(;!u.isEmpty();)u.shift().resolve(c);return Promise.resolve(c)}},once=async function(e,t,r={}){const n=r?.signal;if(n?.aborted)throw new b(void 0,{cause:n?.reason});return new Promise((s,o)=>{const i=v=>{typeof e.removeListener=="function"&&e.removeListener(t,u),n!=null&&L(n,"abort",f),o(v)},u=(...v)=>{typeof e.removeListener=="function"&&e.removeListener("error",i),n!=null&&L(n,"abort",f),s(v)},a={__proto__:null,once:!0,[N]:!0};P(e,t,u,a),t!=="error"&&typeof e.once=="function"&&e.once("error",i);function f(){L(e,t,u),L(e,"error",i),o(new b(void 0,{cause:n?.reason}))}n!=null&&P(n,"abort",f,{__proto__:null,once:!0,[N]:!0})})},addAbortListener=function(e,t){if(e===void 0)throw new h("signal","AbortSignal",e);let r;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener("abort",t,{__proto__:null,once:!0,[N]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[Symbol.dispose](){r?.()}}},getEventListeners=function(e,t){if(typeof e.listeners=="function")return e.listeners(t);if($(e)){const r=e[kEvents].get(t),n=[];let s=r?.next;for(;s?.listener!==void 0;){const o=s.listener?.deref?s.listener.deref():s.listener;n.push(o),s=s.next}return n}throw new h("emitter",["EventEmitter","EventTarget"],e)},getMaxListeners=function(e){if(typeof e?.getMaxListeners=="function")return S(e);if(e?.[w])return e[w];throw new h("emitter",["EventEmitter","EventTarget"],e)},D=2048,M=D-1;class B{bottom;top;list;next;constructor(){this.bottom=0,this.top=0,this.list=new Array(D),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&M)===this.bottom}push(t){this.list[this.top]=t,this.top=this.top+1&M}shift(){const t=this.list[this.bottom];return t===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&M,t)}}class O{head;tail;constructor(){this.head=this.tail=new B}isEmpty(){return this.head.isEmpty()}push(t){this.head.isFull()&&(this.head=this.head.next=new B),this.head.push(t)}shift(){const t=this.tail,r=t.shift();return t.isEmpty()&&t.next!==null&&(this.tail=t.next,t.next=null),r}}function $(e){return typeof e?.addEventListener=="function"}function H(e,t,r,n){if(e[l])try{const s=t.then;typeof s=="function"&&s.call(t,void 0,function(o){process.nextTick(se,e,o,r,n)})}catch(s){e.emit("error",s)}}function se(e,t,r,n){if(typeof e[R]=="function")e[R](t,r,...n);else{const s=e[l];try{e[l]=!1,e.emit("error",t)}finally{e[l]=s}}}function S(e){return e._maxListeners===void 0?y:e._maxListeners}function re(e,t){let r="";try{const{name:o}=this.constructor;o!=="EventEmitter"&&(r=` on ${o} instance`)}catch{}const n=`
"use strict";let y=10;const Y=Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})()))),F=(e,t)=>e,g=Error,J=Error,h=Error,b=Error,Z=Error,R=Symbol.for("nodejs.rejection"),l=Symbol.for("kCapture"),A=Symbol.for("events.errorMonitor"),p=Symbol.for("shapeMode"),w=Symbol.for("events.maxEventTargetListeners"),ee=Symbol.for("kEnhanceStackBeforeInspector"),te=Symbol.for("nodejs.watermarkData"),E=Symbol.for("kAsyncResource"),ne=Symbol.for("kFirstEventParam"),N=Symbol.for("kResistStopPropagation"),W=Symbol.for("events.maxEventTargetListenersWarned");class EventEmitter{_events=void 0;_eventsCount=0;_maxListeners=y;[l]=!1;[p]=!1;static captureRejectionSymbol=R;static errorMonitor=A;static kMaxEventTargetListeners=w;static kMaxEventTargetListenersWarned=W;static usingDomains=!1;static get on(){return on}static get once(){return once}static get getEventListeners(){return getEventListeners}static get getMaxListeners(){return getMaxListeners}static get addAbortListener(){return addAbortListener}static get EventEmitterAsyncResource(){return EventEmitterAsyncResource}static get EventEmitter(){return EventEmitter}static setMaxListeners(t=y,...r){if(r.length===0)y=t;else for(const n of r)if($(n))n[w]=t,n[W]=!1;else if(typeof n.setMaxListeners=="function")n.setMaxListeners(t);else throw new h("eventTargets",["EventEmitter","EventTarget"],n)}static listenerCount(t,r){if(typeof t.listenerCount=="function")return t.listenerCount(r);EventEmitter.prototype.listenerCount.call(t,r)}static init(){throw new Error("EventEmitter.init() is not implemented.")}static get captureRejections(){return this[l]}static set captureRejections(t){this[l]=t}static get defaultMaxListeners(){return y}static set defaultMaxListeners(t){y=t}constructor(t){this._events===void 0||this._events===Object.getPrototypeOf(this)._events?(this._events={__proto__:null},this._eventsCount=0,this[p]=!1):this[p]=!0,this._maxListeners=this._maxListeners||void 0,t?.captureRejections?this[l]=!!t.captureRejections:this[l]=EventEmitter.prototype[l]}setMaxListeners(t){return this._maxListeners=t,this}getMaxListeners(){return S(this)}emit(t,...r){let n=t==="error";const s=this._events;if(s!==void 0)n&&s[A]!==void 0&&this.emit(A,...r),n=n&&s.error===void 0;else if(!n)return!1;if(n){let i;if(r.length>0&&(i=r[0]),i instanceof Error){try{const f={};Error.captureStackTrace?.(f,EventEmitter.prototype.emit),Object.defineProperty(i,ee,{__proto__:null,value:Function.prototype.bind(se,this,i,f),configurable:!0})}catch{}throw i}let u;try{u=F(i)}catch{u=i}const a=new J(u);throw a.context=i,a}const o=s[t];if(o===void 0)return!1;if(typeof o=="function"){const i=o.apply(this,r);i!=null&&H(this,i,t,r)}else{const i=o.length,u=C(o);for(let a=0;a<i;++a){const f=u[a].apply(this,r);f!=null&&H(this,f,t,r)}}return!0}addListener(t,r){return z(this,t,r,!1),this}on(t,r){return this.addListener(t,r)}prependListener(t,r){return z(this,t,r,!0),this}once(t,r){return this.on(t,U(this,t,r)),this}prependOnceListener(t,r){return this.prependListener(t,U(this,t,r)),this}removeListener(t,r){const n=this._events;if(n===void 0)return this;const s=n[t];if(s===void 0)return this;if(s===r||s.listener===r)this._eventsCount-=1,this[p]?n[t]=void 0:this._eventsCount===0?this._events={__proto__:null}:(delete n[t],n.removeListener&&this.emit("removeListener",t,s.listener||r));else if(typeof s!="function"){let o=-1;for(let i=s.length-1;i>=0;i--)if(s[i]===r||s[i].listener===r){o=i;break}if(o<0)return this;o===0?s.shift():ce(s,o),s.length===1&&(n[t]=s[0]),n.removeListener!==void 0&&this.emit("removeListener",t,r)}return this}off(t,r){return this.removeListener(t,r)}removeAllListeners(t){const r=this._events;if(r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events={__proto__:null},this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events={__proto__:null}:delete r[t]),this[p]=!1,this;if(arguments.length===0){for(const s of Reflect.ownKeys(r))s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={__proto__:null},this._eventsCount=0,this[p]=!1,this}const n=r[t];if(typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(let s=n.length-1;s>=0;s--)this.removeListener(t,n[s]);return this}listeners(t){return G(this,t,!0)}rawListeners(t){return G(this,t,!1)}eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}listenerCount(t,r){const n=this._events;if(n!==void 0){const s=n[t];if(typeof s=="function")return r!=null?r===s||r===s.listener?1:0:1;if(s!==void 0){if(r!=null){let o=0;for(let i=0,u=s.length;i<u;i++)(s[i]===r||s[i].listener===r)&&o++;return o}return s.length}}return 0}}class EventEmitterAsyncResource extends EventEmitter{constructor(t){let r;typeof t=="string"?(r=t,t=void 0):r=t?.name||new.target.name,super(t),this[E]=new EventEmitterReferencingAsyncResource(this,r,t)}emit(t,...r){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");const{asyncResource:n}=this;return Array.prototype.unshift(r,super.emit,this,t),Reflect.apply(n.runInAsyncScope,n,r)}emitDestroy(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");this.asyncResource.emitDestroy()}get asyncId(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this.asyncResource.asyncId()}get triggerAsyncId(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this.asyncResource.triggerAsyncId()}get asyncResource(){if(this[E]===void 0)throw new g("EventEmitterAsyncResource");return this[E]}}const on=function(e,t,r={}){const n=r.signal;if(n?.aborted)throw new b(void 0,{cause:n?.reason});const s=r.highWaterMark??r.highWatermark??Number.MAX_SAFE_INTEGER,o=r.lowWaterMark??r.lowWatermark??1,i=new O,u=new O;let a=!1,f=null,v=!1,m=0;const I=Object.setPrototypeOf({next(){if(m){const c=i.shift();return m--,a&&m<o&&(e.resume?.(),a=!1),Promise.resolve(T(c,!1))}if(f){const c=Promise.reject(f);return f=null,c}return v?d():new Promise(function(c,V){u.push({resolve:c,reject:V})})},return(){return d()},throw(c){if(!c||!(c instanceof Error))throw new h("EventEmitter.AsyncIterator","Error",c);x(c)},[Symbol.asyncIterator](){return this},[te]:{get size(){return m},get low(){return o},get high(){return s},get isPaused(){return a}}},Y),{addEventListener:_,removeAll:K}=ue();_(e,t,r[ne]?j:function(...c){return j(c)}),t!=="error"&&typeof e.on=="function"&&_(e,"error",x);const k=r?.close;if(k?.length)for(const c of k)_(e,c,d);const q=n?addAbortListener(n,Q):null;return I;function Q(){x(new b(void 0,{cause:n?.reason}))}function j(c){u.isEmpty()?(m++,!a&&m>s&&(a=!0,e.pause?.()),i.push(c)):u.shift().resolve(T(c,!1))}function x(c){u.isEmpty()?f=c:u.shift().reject(c),d()}function d(){q?.[Symbol.dispose](),K(),v=!0;const c=T(void 0,!0);for(;!u.isEmpty();)u.shift().resolve(c);return Promise.resolve(c)}},once=async function(e,t,r={}){const n=r?.signal;if(n?.aborted)throw new b(void 0,{cause:n?.reason});return new Promise((s,o)=>{const i=v=>{typeof e.removeListener=="function"&&e.removeListener(t,u),n!=null&&L(n,"abort",f),o(v)},u=(...v)=>{typeof e.removeListener=="function"&&e.removeListener("error",i),n!=null&&L(n,"abort",f),s(v)},a={__proto__:null,once:!0,[N]:!0};P(e,t,u,a),t!=="error"&&typeof e.once=="function"&&e.once("error",i);function f(){L(e,t,u),L(e,"error",i),o(new b(void 0,{cause:n?.reason}))}n!=null&&P(n,"abort",f,{__proto__:null,once:!0,[N]:!0})})},addAbortListener=function(e,t){if(e===void 0)throw new h("signal","AbortSignal",e);let r;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener("abort",t,{__proto__:null,once:!0,[N]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[Symbol.dispose](){r?.()}}},getEventListeners=function(e,t){if(typeof e.listeners=="function")return e.listeners(t);if($(e)){const r=e[kEvents].get(t),n=[];let s=r?.next;for(;s?.listener!==void 0;){const o=s.listener?.deref?s.listener.deref():s.listener;n.push(o),s=s.next}return n}throw new h("emitter",["EventEmitter","EventTarget"],e)},getMaxListeners=function(e){if(typeof e?.getMaxListeners=="function")return S(e);if(e?.[w])return e[w];throw new h("emitter",["EventEmitter","EventTarget"],e)},D=2048,M=D-1;class B{bottom=0;top=0;list;next;constructor(){this.list=new Array(D),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&M)===this.bottom}push(t){this.list[this.top]=t,this.top=this.top+1&M}shift(){const t=this.list[this.bottom];return t===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&M,t)}}class O{head;tail;constructor(){this.head=this.tail=new B}isEmpty(){return this.head.isEmpty()}push(t){this.head.isFull()&&(this.head=this.head.next=new B),this.head.push(t)}shift(){const t=this.tail,r=t.shift();return t.isEmpty()&&t.next!==null&&(this.tail=t.next,t.next=null),r}}function $(e){return typeof e?.addEventListener=="function"}function H(e,t,r,n){if(e[l])try{const s=t.then;typeof s=="function"&&s.call(t,void 0,function(o){process.nextTick(re,e,o,r,n)})}catch(s){e.emit("error",s)}}function re(e,t,r,n){if(typeof e[R]=="function")e[R](t,r,...n);else{const s=e[l];try{e[l]=!1,e.emit("error",t)}finally{e[l]=s}}}function S(e){return e._maxListeners===void 0?y:e._maxListeners}function se(e,t){let r="";try{const{name:o}=this.constructor;o!=="EventEmitter"&&(r=` on ${o} instance`)}catch{}const n=`
Emitted 'error' event${r} at:

@@ -3,0 +3,0 @@ `,s=(t.stack||"").split(`

@@ -1,2 +0,2 @@

let y=10;const Y=Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})()))),F=(e,t)=>e,_=Error,Z=Error,h=Error,w=Error,tt=Error,R=Symbol.for("nodejs.rejection"),f=Symbol.for("kCapture"),M=Symbol.for("events.errorMonitor"),g=Symbol.for("shapeMode"),b=Symbol.for("events.maxEventTargetListeners"),et=Symbol.for("kEnhanceStackBeforeInspector"),rt=Symbol.for("nodejs.watermarkData"),v=Symbol.for("kAsyncResource"),nt=Symbol.for("kFirstEventParam"),S=Symbol.for("kResistStopPropagation"),W=Symbol.for("events.maxEventTargetListenersWarned");class m{_events=void 0;_eventsCount=0;_maxListeners=y;[f]=!1;[g]=!1;static captureRejectionSymbol=R;static errorMonitor=M;static kMaxEventTargetListeners=b;static kMaxEventTargetListenersWarned=W;static usingDomains=!1;static get on(){return it}static get once(){return ot}static get getEventListeners(){return ct}static get getMaxListeners(){return ut}static get addAbortListener(){return $}static get EventEmitterAsyncResource(){return st}static get EventEmitter(){return m}static setMaxListeners(t=y,...r){if(r.length===0)y=t;else for(const n of r)if(q(n))n[b]=t,n[W]=!1;else if(typeof n.setMaxListeners=="function")n.setMaxListeners(t);else throw new h("eventTargets",["EventEmitter","EventTarget"],n)}static listenerCount(t,r){if(typeof t.listenerCount=="function")return t.listenerCount(r);m.prototype.listenerCount.call(t,r)}static init(){throw new Error("EventEmitter.init() is not implemented.")}static get captureRejections(){return this[f]}static set captureRejections(t){this[f]=t}static get defaultMaxListeners(){return y}static set defaultMaxListeners(t){y=t}constructor(t){this._events===void 0||this._events===Object.getPrototypeOf(this)._events?(this._events={__proto__:null},this._eventsCount=0,this[g]=!1):this[g]=!0,this._maxListeners=this._maxListeners||void 0,t?.captureRejections?this[f]=!!t.captureRejections:this[f]=m.prototype[f]}setMaxListeners(t){return this._maxListeners=t,this}getMaxListeners(){return j(this)}emit(t,...r){let n=t==="error";const s=this._events;if(s!==void 0)n&&s[M]!==void 0&&this.emit(M,...r),n=n&&s.error===void 0;else if(!n)return!1;if(n){let i;if(r.length>0&&(i=r[0]),i instanceof Error){try{const a={};Error.captureStackTrace?.(a,m.prototype.emit),Object.defineProperty(i,et,{__proto__:null,value:Function.prototype.bind(at,this,i,a),configurable:!0})}catch{}throw i}let u;try{u=F(i)}catch{u=i}const l=new Z(u);throw l.context=i,l}const o=s[t];if(o===void 0)return!1;if(typeof o=="function"){const i=o.apply(this,r);i!=null&&z(this,i,t,r)}else{const i=o.length,u=C(o);for(let l=0;l<i;++l){const a=u[l].apply(this,r);a!=null&&z(this,a,t,r)}}return!0}addListener(t,r){return B(this,t,r,!1),this}on(t,r){return this.addListener(t,r)}prependListener(t,r){return B(this,t,r,!0),this}once(t,r){return this.on(t,G(this,t,r)),this}prependOnceListener(t,r){return this.prependListener(t,G(this,t,r)),this}removeListener(t,r){const n=this._events;if(n===void 0)return this;const s=n[t];if(s===void 0)return this;if(s===r||s.listener===r)this._eventsCount-=1,this[g]?n[t]=void 0:this._eventsCount===0?this._events={__proto__:null}:(delete n[t],n.removeListener&&this.emit("removeListener",t,s.listener||r));else if(typeof s!="function"){let o=-1;for(let i=s.length-1;i>=0;i--)if(s[i]===r||s[i].listener===r){o=i;break}if(o<0)return this;o===0?s.shift():mt(s,o),s.length===1&&(n[t]=s[0]),n.removeListener!==void 0&&this.emit("removeListener",t,r)}return this}off(t,r){return this.removeListener(t,r)}removeAllListeners(t){const r=this._events;if(r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events={__proto__:null},this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events={__proto__:null}:delete r[t]),this[g]=!1,this;if(arguments.length===0){for(const s of Reflect.ownKeys(r))s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={__proto__:null},this._eventsCount=0,this[g]=!1,this}const n=r[t];if(typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(let s=n.length-1;s>=0;s--)this.removeListener(t,n[s]);return this}listeners(t){return U(this,t,!0)}rawListeners(t){return U(this,t,!1)}eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}listenerCount(t,r){const n=this._events;if(n!==void 0){const s=n[t];if(typeof s=="function")return r!=null?r===s||r===s.listener?1:0:1;if(s!==void 0){if(r!=null){let o=0;for(let i=0,u=s.length;i<u;i++)(s[i]===r||s[i].listener===r)&&o++;return o}return s.length}}return 0}}class st extends m{constructor(t){let r;typeof t=="string"?(r=t,t=void 0):r=t?.name||new.target.name,super(t),this[v]=new EventEmitterReferencingAsyncResource(this,r,t)}emit(t,...r){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");const{asyncResource:n}=this;return Array.prototype.unshift(r,super.emit,this,t),Reflect.apply(n.runInAsyncScope,n,r)}emitDestroy(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");this.asyncResource.emitDestroy()}get asyncId(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this.asyncResource.asyncId()}get triggerAsyncId(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this.asyncResource.triggerAsyncId()}get asyncResource(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this[v]}}const it=function(e,t,r={}){const n=r.signal;if(n?.aborted)throw new w(void 0,{cause:n?.reason});const s=r.highWaterMark??r.highWatermark??Number.MAX_SAFE_INTEGER,o=r.lowWaterMark??r.lowWatermark??1,i=new K,u=new K;let l=!1,a=null,p=!1,d=0;const H=Object.setPrototypeOf({next(){if(d){const c=i.shift();return d--,l&&d<o&&(e.resume?.(),l=!1),Promise.resolve(P(c,!1))}if(a){const c=Promise.reject(a);return a=null,c}return p?L():new Promise(function(c,X){u.push({resolve:c,reject:X})})},return(){return L()},throw(c){if(!c||!(c instanceof Error))throw new h("EventEmitter.AsyncIterator","Error",c);A(c)},[Symbol.asyncIterator](){return this},[rt]:{get size(){return d},get low(){return o},get high(){return s},get isPaused(){return l}}},Y),{addEventListener:x,removeAll:J}=vt();x(e,t,r[nt]?I:function(...c){return I(c)}),t!=="error"&&typeof e.on=="function"&&x(e,"error",A);const T=r?.close;if(T?.length)for(const c of T)x(e,c,L);const Q=n?$(n,V):null;return H;function V(){A(new w(void 0,{cause:n?.reason}))}function I(c){u.isEmpty()?(d++,!l&&d>s&&(l=!0,e.pause?.()),i.push(c)):u.shift().resolve(P(c,!1))}function A(c){u.isEmpty()?a=c:u.shift().reject(c),L()}function L(){Q?.[Symbol.dispose](),J(),p=!0;const c=P(void 0,!0);for(;!u.isEmpty();)u.shift().resolve(c);return Promise.resolve(c)}},ot=async function(e,t,r={}){const n=r?.signal;if(n?.aborted)throw new w(void 0,{cause:n?.reason});return new Promise((s,o)=>{const i=p=>{typeof e.removeListener=="function"&&e.removeListener(t,u),n!=null&&E(n,"abort",a),o(p)},u=(...p)=>{typeof e.removeListener=="function"&&e.removeListener("error",i),n!=null&&E(n,"abort",a),s(p)},l={__proto__:null,once:!0,[S]:!0};O(e,t,u,l),t!=="error"&&typeof e.once=="function"&&e.once("error",i);function a(){E(e,t,u),E(e,"error",i),o(new w(void 0,{cause:n?.reason}))}n!=null&&O(n,"abort",a,{__proto__:null,once:!0,[S]:!0})})},$=function(e,t){if(e===void 0)throw new h("signal","AbortSignal",e);let r;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener("abort",t,{__proto__:null,once:!0,[S]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[Symbol.dispose](){r?.()}}},ct=function(e,t){if(typeof e.listeners=="function")return e.listeners(t);if(q(e)){const r=e[kEvents].get(t),n=[];let s=r?.next;for(;s?.listener!==void 0;){const o=s.listener?.deref?s.listener.deref():s.listener;n.push(o),s=s.next}return n}throw new h("emitter",["EventEmitter","EventTarget"],e)},ut=function(e){if(typeof e?.getMaxListeners=="function")return j(e);if(e?.[b])return e[b];throw new h("emitter",["EventEmitter","EventTarget"],e)},D=2048,k=D-1;class N{bottom;top;list;next;constructor(){this.bottom=0,this.top=0,this.list=new Array(D),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&k)===this.bottom}push(t){this.list[this.top]=t,this.top=this.top+1&k}shift(){const t=this.list[this.bottom];return t===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&k,t)}}class K{head;tail;constructor(){this.head=this.tail=new N}isEmpty(){return this.head.isEmpty()}push(t){this.head.isFull()&&(this.head=this.head.next=new N),this.head.push(t)}shift(){const t=this.tail,r=t.shift();return t.isEmpty()&&t.next!==null&&(this.tail=t.next,t.next=null),r}}function q(e){return typeof e?.addEventListener=="function"}function z(e,t,r,n){if(e[f])try{const s=t.then;typeof s=="function"&&s.call(t,void 0,function(o){process.nextTick(lt,e,o,r,n)})}catch(s){e.emit("error",s)}}function lt(e,t,r,n){if(typeof e[R]=="function")e[R](t,r,...n);else{const s=e[f];try{e[f]=!1,e.emit("error",t)}finally{e[f]=s}}}function j(e){return e._maxListeners===void 0?y:e._maxListeners}function at(e,t){let r="";try{const{name:o}=this.constructor;o!=="EventEmitter"&&(r=` on ${o} instance`)}catch{}const n=`
let y=10;const Y=Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})()))),F=(e,t)=>e,_=Error,Z=Error,h=Error,w=Error,tt=Error,R=Symbol.for("nodejs.rejection"),f=Symbol.for("kCapture"),M=Symbol.for("events.errorMonitor"),g=Symbol.for("shapeMode"),b=Symbol.for("events.maxEventTargetListeners"),et=Symbol.for("kEnhanceStackBeforeInspector"),rt=Symbol.for("nodejs.watermarkData"),v=Symbol.for("kAsyncResource"),nt=Symbol.for("kFirstEventParam"),S=Symbol.for("kResistStopPropagation"),W=Symbol.for("events.maxEventTargetListenersWarned");class m{_events=void 0;_eventsCount=0;_maxListeners=y;[f]=!1;[g]=!1;static captureRejectionSymbol=R;static errorMonitor=M;static kMaxEventTargetListeners=b;static kMaxEventTargetListenersWarned=W;static usingDomains=!1;static get on(){return it}static get once(){return ot}static get getEventListeners(){return ct}static get getMaxListeners(){return ut}static get addAbortListener(){return $}static get EventEmitterAsyncResource(){return st}static get EventEmitter(){return m}static setMaxListeners(t=y,...r){if(r.length===0)y=t;else for(const n of r)if(q(n))n[b]=t,n[W]=!1;else if(typeof n.setMaxListeners=="function")n.setMaxListeners(t);else throw new h("eventTargets",["EventEmitter","EventTarget"],n)}static listenerCount(t,r){if(typeof t.listenerCount=="function")return t.listenerCount(r);m.prototype.listenerCount.call(t,r)}static init(){throw new Error("EventEmitter.init() is not implemented.")}static get captureRejections(){return this[f]}static set captureRejections(t){this[f]=t}static get defaultMaxListeners(){return y}static set defaultMaxListeners(t){y=t}constructor(t){this._events===void 0||this._events===Object.getPrototypeOf(this)._events?(this._events={__proto__:null},this._eventsCount=0,this[g]=!1):this[g]=!0,this._maxListeners=this._maxListeners||void 0,t?.captureRejections?this[f]=!!t.captureRejections:this[f]=m.prototype[f]}setMaxListeners(t){return this._maxListeners=t,this}getMaxListeners(){return j(this)}emit(t,...r){let n=t==="error";const s=this._events;if(s!==void 0)n&&s[M]!==void 0&&this.emit(M,...r),n=n&&s.error===void 0;else if(!n)return!1;if(n){let i;if(r.length>0&&(i=r[0]),i instanceof Error){try{const a={};Error.captureStackTrace?.(a,m.prototype.emit),Object.defineProperty(i,et,{__proto__:null,value:Function.prototype.bind(at,this,i,a),configurable:!0})}catch{}throw i}let u;try{u=F(i)}catch{u=i}const l=new Z(u);throw l.context=i,l}const o=s[t];if(o===void 0)return!1;if(typeof o=="function"){const i=o.apply(this,r);i!=null&&z(this,i,t,r)}else{const i=o.length,u=C(o);for(let l=0;l<i;++l){const a=u[l].apply(this,r);a!=null&&z(this,a,t,r)}}return!0}addListener(t,r){return B(this,t,r,!1),this}on(t,r){return this.addListener(t,r)}prependListener(t,r){return B(this,t,r,!0),this}once(t,r){return this.on(t,G(this,t,r)),this}prependOnceListener(t,r){return this.prependListener(t,G(this,t,r)),this}removeListener(t,r){const n=this._events;if(n===void 0)return this;const s=n[t];if(s===void 0)return this;if(s===r||s.listener===r)this._eventsCount-=1,this[g]?n[t]=void 0:this._eventsCount===0?this._events={__proto__:null}:(delete n[t],n.removeListener&&this.emit("removeListener",t,s.listener||r));else if(typeof s!="function"){let o=-1;for(let i=s.length-1;i>=0;i--)if(s[i]===r||s[i].listener===r){o=i;break}if(o<0)return this;o===0?s.shift():mt(s,o),s.length===1&&(n[t]=s[0]),n.removeListener!==void 0&&this.emit("removeListener",t,r)}return this}off(t,r){return this.removeListener(t,r)}removeAllListeners(t){const r=this._events;if(r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events={__proto__:null},this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events={__proto__:null}:delete r[t]),this[g]=!1,this;if(arguments.length===0){for(const s of Reflect.ownKeys(r))s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events={__proto__:null},this._eventsCount=0,this[g]=!1,this}const n=r[t];if(typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(let s=n.length-1;s>=0;s--)this.removeListener(t,n[s]);return this}listeners(t){return U(this,t,!0)}rawListeners(t){return U(this,t,!1)}eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}listenerCount(t,r){const n=this._events;if(n!==void 0){const s=n[t];if(typeof s=="function")return r!=null?r===s||r===s.listener?1:0:1;if(s!==void 0){if(r!=null){let o=0;for(let i=0,u=s.length;i<u;i++)(s[i]===r||s[i].listener===r)&&o++;return o}return s.length}}return 0}}class st extends m{constructor(t){let r;typeof t=="string"?(r=t,t=void 0):r=t?.name||new.target.name,super(t),this[v]=new EventEmitterReferencingAsyncResource(this,r,t)}emit(t,...r){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");const{asyncResource:n}=this;return Array.prototype.unshift(r,super.emit,this,t),Reflect.apply(n.runInAsyncScope,n,r)}emitDestroy(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");this.asyncResource.emitDestroy()}get asyncId(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this.asyncResource.asyncId()}get triggerAsyncId(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this.asyncResource.triggerAsyncId()}get asyncResource(){if(this[v]===void 0)throw new _("EventEmitterAsyncResource");return this[v]}}const it=function(e,t,r={}){const n=r.signal;if(n?.aborted)throw new w(void 0,{cause:n?.reason});const s=r.highWaterMark??r.highWatermark??Number.MAX_SAFE_INTEGER,o=r.lowWaterMark??r.lowWatermark??1,i=new K,u=new K;let l=!1,a=null,p=!1,d=0;const H=Object.setPrototypeOf({next(){if(d){const c=i.shift();return d--,l&&d<o&&(e.resume?.(),l=!1),Promise.resolve(P(c,!1))}if(a){const c=Promise.reject(a);return a=null,c}return p?L():new Promise(function(c,X){u.push({resolve:c,reject:X})})},return(){return L()},throw(c){if(!c||!(c instanceof Error))throw new h("EventEmitter.AsyncIterator","Error",c);A(c)},[Symbol.asyncIterator](){return this},[rt]:{get size(){return d},get low(){return o},get high(){return s},get isPaused(){return l}}},Y),{addEventListener:x,removeAll:J}=vt();x(e,t,r[nt]?I:function(...c){return I(c)}),t!=="error"&&typeof e.on=="function"&&x(e,"error",A);const T=r?.close;if(T?.length)for(const c of T)x(e,c,L);const Q=n?$(n,V):null;return H;function V(){A(new w(void 0,{cause:n?.reason}))}function I(c){u.isEmpty()?(d++,!l&&d>s&&(l=!0,e.pause?.()),i.push(c)):u.shift().resolve(P(c,!1))}function A(c){u.isEmpty()?a=c:u.shift().reject(c),L()}function L(){Q?.[Symbol.dispose](),J(),p=!0;const c=P(void 0,!0);for(;!u.isEmpty();)u.shift().resolve(c);return Promise.resolve(c)}},ot=async function(e,t,r={}){const n=r?.signal;if(n?.aborted)throw new w(void 0,{cause:n?.reason});return new Promise((s,o)=>{const i=p=>{typeof e.removeListener=="function"&&e.removeListener(t,u),n!=null&&E(n,"abort",a),o(p)},u=(...p)=>{typeof e.removeListener=="function"&&e.removeListener("error",i),n!=null&&E(n,"abort",a),s(p)},l={__proto__:null,once:!0,[S]:!0};O(e,t,u,l),t!=="error"&&typeof e.once=="function"&&e.once("error",i);function a(){E(e,t,u),E(e,"error",i),o(new w(void 0,{cause:n?.reason}))}n!=null&&O(n,"abort",a,{__proto__:null,once:!0,[S]:!0})})},$=function(e,t){if(e===void 0)throw new h("signal","AbortSignal",e);let r;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener("abort",t,{__proto__:null,once:!0,[S]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[Symbol.dispose](){r?.()}}},ct=function(e,t){if(typeof e.listeners=="function")return e.listeners(t);if(q(e)){const r=e[kEvents].get(t),n=[];let s=r?.next;for(;s?.listener!==void 0;){const o=s.listener?.deref?s.listener.deref():s.listener;n.push(o),s=s.next}return n}throw new h("emitter",["EventEmitter","EventTarget"],e)},ut=function(e){if(typeof e?.getMaxListeners=="function")return j(e);if(e?.[b])return e[b];throw new h("emitter",["EventEmitter","EventTarget"],e)},D=2048,k=D-1;class N{bottom=0;top=0;list;next;constructor(){this.list=new Array(D),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&k)===this.bottom}push(t){this.list[this.top]=t,this.top=this.top+1&k}shift(){const t=this.list[this.bottom];return t===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&k,t)}}class K{head;tail;constructor(){this.head=this.tail=new N}isEmpty(){return this.head.isEmpty()}push(t){this.head.isFull()&&(this.head=this.head.next=new N),this.head.push(t)}shift(){const t=this.tail,r=t.shift();return t.isEmpty()&&t.next!==null&&(this.tail=t.next,t.next=null),r}}function q(e){return typeof e?.addEventListener=="function"}function z(e,t,r,n){if(e[f])try{const s=t.then;typeof s=="function"&&s.call(t,void 0,function(o){process.nextTick(lt,e,o,r,n)})}catch(s){e.emit("error",s)}}function lt(e,t,r,n){if(typeof e[R]=="function")e[R](t,r,...n);else{const s=e[f];try{e[f]=!1,e.emit("error",t)}finally{e[f]=s}}}function j(e){return e._maxListeners===void 0?y:e._maxListeners}function at(e,t){let r="";try{const{name:o}=this.constructor;o!=="EventEmitter"&&(r=` on ${o} instance`)}catch{}const n=`
Emitted 'error' event${r} at:

@@ -3,0 +3,0 @@ `,s=(t.stack||"").split(`

@@ -1,1 +0,1 @@

"use strict";const events=require("node-mock-http/_polyfill/events"),buffer=require("node-mock-http/_polyfill/buffer");function createNotImplementedError(n){throw new Error(`${n} is not implemented yet!`)}class Readable extends events.EventEmitter{__unenv__={};readableEncoding=null;readableEnded=!0;readableFlowing=!1;readableHighWaterMark=0;readableLength=0;readableObjectMode=!1;readableAborted=!1;readableDidRead=!1;closed=!1;errored=null;readable=!1;destroyed=!1;static from(e,t){return new Readable(t)}constructor(e){super()}_read(e){}read(e){}setEncoding(e){return this}pause(){return this}resume(){return this}isPaused(){return!0}unpipe(e){return this}unshift(e,t){}wrap(e){return this}push(e,t){return!1}_destroy(e,t){this.removeAllListeners()}destroy(e){return this.destroyed=!0,this._destroy(e),this}pipe(e,t){return{}}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return this.destroy(),Promise.resolve()}async*[Symbol.asyncIterator](){throw createNotImplementedError("Readable.asyncIterator")}iterator(e){throw createNotImplementedError("Readable.iterator")}map(e,t){throw createNotImplementedError("Readable.map")}filter(e,t){throw createNotImplementedError("Readable.filter")}forEach(e,t){throw createNotImplementedError("Readable.forEach")}reduce(e,t,r){throw createNotImplementedError("Readable.reduce")}find(e,t){throw createNotImplementedError("Readable.find")}findIndex(e,t){throw createNotImplementedError("Readable.findIndex")}some(e,t){throw createNotImplementedError("Readable.some")}toArray(e){throw createNotImplementedError("Readable.toArray")}every(e,t){throw createNotImplementedError("Readable.every")}flatMap(e,t){throw createNotImplementedError("Readable.flatMap")}drop(e,t){throw createNotImplementedError("Readable.drop")}take(e,t){throw createNotImplementedError("Readable.take")}asIndexedPairs(e){throw createNotImplementedError("Readable.asIndexedPairs")}}class Writable extends events.EventEmitter{__unenv__={};writable=!0;writableEnded=!1;writableFinished=!1;writableHighWaterMark=0;writableLength=0;writableObjectMode=!1;writableCorked=0;closed=!1;errored=null;writableNeedDrain=!1;writableAborted=!1;destroyed=!1;_data;_encoding="utf8";constructor(e){super()}pipe(e,t){return{}}_write(e,t,r){if(this.writableEnded){r&&r();return}if(this._data===void 0)this._data=e;else{const s=typeof this._data=="string"?buffer.Buffer.from(this._data,this._encoding||t||"utf8"):this._data,i=typeof e=="string"?buffer.Buffer.from(e,t||this._encoding||"utf8"):e;this._data=buffer.Buffer.concat([s,i])}this._encoding=t,r&&r()}_writev(e,t){}_destroy(e,t){}_final(e){}write(e,t,r){const s=typeof t=="string"?this._encoding:"utf8",i=typeof t=="function"?t:typeof r=="function"?r:void 0;return this._write(e,s,i),!0}setDefaultEncoding(e){return this}end(e,t,r){const s=typeof e=="function"?e:typeof t=="function"?t:typeof r=="function"?r:void 0;if(this.writableEnded)return s&&s(),this;const i=e===s?void 0:e;if(i){const u=t===s?void 0:t;this.write(i,u,s)}return this.writableEnded=!0,this.writableFinished=!0,this.emit("close"),this.emit("finish"),this}cork(){}uncork(){}destroy(e){return this.destroyed=!0,delete this._data,this.removeAllListeners(),this}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return Promise.resolve()}}const o$2=class{allowHalfOpen=!0;_destroy;constructor(e=new Readable,t=new Writable){Object.assign(this,e),Object.assign(this,t),this._destroy=a(e._destroy,t._destroy)}};function p$1(){return Object.assign(o$2.prototype,Readable.prototype),Object.assign(o$2.prototype,Writable.prototype),o$2}function a(...n){return function(...e){for(const t of n)t(...e)}}const Duplex=p$1();class Socket extends Duplex{__unenv__={};bufferSize=0;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!1;localAddress="";localPort=0;remoteAddress="";remoteFamily="";remotePort=0;autoSelectFamilyAttemptedAddresses=[];readyState="readOnly";constructor(e){super()}write(e,t,r){return!1}connect(e,t,r){return this}end(e,t,r){return this}setEncoding(e){return this}pause(){return this}resume(){return this}setTimeout(e,t){return this}setNoDelay(e){return this}setKeepAlive(e,t){return this}address(){return{}}unref(){return this}ref(){return this}destroySoon(){this.destroy()}resetAndDestroy(){const e=new Error("ERR_SOCKET_CLOSED");return e.code="ERR_SOCKET_CLOSED",this.destroy(e),this}}class IncomingMessage extends Readable{aborted=!1;httpVersion="1.1";httpVersionMajor=1;httpVersionMinor=1;complete=!0;connection;socket;headers={};trailers={};method="GET";url="/";statusCode=200;statusMessage="";closed=!1;errored=null;readable=!1;constructor(e){super(),this.socket=this.connection=e||new Socket}get rawHeaders(){const e=this.headers,t=[];for(const r in e)if(Array.isArray(e[r]))for(const s of e[r])t.push(r,s);else t.push(r,e[r]);return t}get rawTrailers(){return[]}setTimeout(e,t){return this}get headersDistinct(){return o$1(this.headers)}get trailersDistinct(){return o$1(this.trailers)}}function o$1(n){const e={};for(const[t,r]of Object.entries(n))t&&(e[t]=(Array.isArray(r)?r:[r]).filter(Boolean));return e}class ServerResponse extends Writable{statusCode=200;statusMessage="";upgrading=!1;chunkedEncoding=!1;shouldKeepAlive=!1;useChunkedEncodingByDefault=!1;sendDate=!1;finished=!1;headersSent=!1;strictContentLength=!1;connection=null;socket=null;req;_headers={};constructor(e){super(),this.req=e}assignSocket(e){e._httpMessage=this,this.socket=e,this.connection=e,this.emit("socket",e),this._flush()}_flush(){this.flushHeaders()}detachSocket(e){}writeContinue(e){}writeHead(e,t,r){e&&(this.statusCode=e),typeof t=="string"&&(this.statusMessage=t,t=void 0);const s=r||t;if(s&&!Array.isArray(s))for(const i in s)this.setHeader(i,s[i]);return this.headersSent=!0,this}writeProcessing(){}setTimeout(e,t){return this}appendHeader(e,t){e=e.toLowerCase();const r=this._headers[e],s=[...Array.isArray(r)?r:[r],...Array.isArray(t)?t:[t]].filter(Boolean);return this._headers[e]=s.length>1?s:s[0],this}setHeader(e,t){return this._headers[e.toLowerCase()]=t,this}setHeaders(e){for(const[t,r]of Object.entries(e))this.setHeader(t,r);return this}getHeader(e){return this._headers[e.toLowerCase()]}getHeaders(){return this._headers}getHeaderNames(){return Object.keys(this._headers)}hasHeader(e){return e.toLowerCase()in this._headers}removeHeader(e){delete this._headers[e.toLowerCase()]}addTrailers(e){}flushHeaders(){}writeEarlyHints(e,t){typeof t=="function"&&t()}}const NodeHeadersObj=(()=>{const n=function(){};return n.prototype=Object.create(null),n})();function toNodeRequestHeaders(n={}){const e=new NodeHeadersObj,t=Array.isArray(n)||o(n)?n:Object.entries(n);for(const[r,s]of t)if(s){if(e[r]===void 0){e[r]=s;continue}e[r]=[...Array.isArray(e[r])?e[r]:[e[r]],...Array.isArray(s)?s:[s]]}return e}function o(n){return typeof n?.entries=="function"}function toWebResponseHeaders(n={}){if(n instanceof Headers)return n;const e=new Headers;for(const[t,r]of Object.entries(n))if(r!==void 0){if(Array.isArray(r)){for(const s of r)e.append(t,String(s));continue}e.set(t,String(r))}return e}const p=new Set([101,204,205,304]);async function callNodeRequestHandler(n,e){const t=new IncomingMessage,r=new ServerResponse(t);t.url=e.url?.toString()||"/";let s;if(!t.url.startsWith("/")){const d=new URL(t.url);s=d.host,t.url=d.pathname+d.search+d.hash}t.method=e.method||"GET",t.headers=toNodeRequestHeaders(e.headers||{}),t.headers.host||(t.headers.host=e.host||s||"localhost"),t.connection.encrypted=t.connection.encrypted||e.protocol==="https",t.body=e.body||null,t.__unenv__=e.context,await n(t,r);let i=r._data;(p.has(r.statusCode)||t.method.toUpperCase()==="HEAD")&&(i=null,delete r._headers["content-length"]);const u={status:r.statusCode,statusText:r.statusMessage,headers:r._headers,body:i};return t.destroy(),r.destroy(),u}async function fetchNodeRequestHandler(n,e,t={}){try{const r=await callNodeRequestHandler(n,{url:e,...t});return new Response(r.body,{status:r.status,statusText:r.statusText,headers:toWebResponseHeaders(r.headers)})}catch(r){return new Response(r.toString(),{status:Number.parseInt(r.statusCode||r.code)||500,statusText:r.statusText})}}exports.IncomingMessage=IncomingMessage,exports.ServerResponse=ServerResponse,exports.callNodeRequestHandler=callNodeRequestHandler,exports.fetchNodeRequestHandler=fetchNodeRequestHandler;
"use strict";const events=require("node-mock-http/_polyfill/events"),buffer=require("node-mock-http/_polyfill/buffer");function createNotImplementedError(n){throw new Error(`${n} is not implemented yet!`)}class Readable extends events.EventEmitter{__unenv__={};readableEncoding=null;readableEnded=!0;readableFlowing=!1;readableHighWaterMark=0;readableLength=0;readableObjectMode=!1;readableAborted=!1;readableDidRead=!1;closed=!1;errored=null;readable=!1;destroyed=!1;static from(e,t){return new Readable(t)}constructor(e){super()}_read(e){}read(e){}setEncoding(e){return this}pause(){return this}resume(){return this}isPaused(){return!0}unpipe(e){return this}unshift(e,t){}wrap(e){return this}push(e,t){return!1}_destroy(e,t){this.removeAllListeners()}destroy(e){return this.destroyed=!0,this._destroy(e),this}pipe(e,t){return{}}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return this.destroy(),Promise.resolve()}async*[Symbol.asyncIterator](){throw createNotImplementedError("Readable.asyncIterator")}iterator(e){throw createNotImplementedError("Readable.iterator")}map(e,t){throw createNotImplementedError("Readable.map")}filter(e,t){throw createNotImplementedError("Readable.filter")}forEach(e,t){throw createNotImplementedError("Readable.forEach")}reduce(e,t,r){throw createNotImplementedError("Readable.reduce")}find(e,t){throw createNotImplementedError("Readable.find")}findIndex(e,t){throw createNotImplementedError("Readable.findIndex")}some(e,t){throw createNotImplementedError("Readable.some")}toArray(e){throw createNotImplementedError("Readable.toArray")}every(e,t){throw createNotImplementedError("Readable.every")}flatMap(e,t){throw createNotImplementedError("Readable.flatMap")}drop(e,t){throw createNotImplementedError("Readable.drop")}take(e,t){throw createNotImplementedError("Readable.take")}asIndexedPairs(e){throw createNotImplementedError("Readable.asIndexedPairs")}}class Writable extends events.EventEmitter{__unenv__={};writable=!0;writableEnded=!1;writableFinished=!1;writableHighWaterMark=0;writableLength=0;writableObjectMode=!1;writableCorked=0;closed=!1;errored=null;writableNeedDrain=!1;writableAborted=!1;destroyed=!1;_data;_encoding="utf8";constructor(e){super()}pipe(e,t){return{}}_write(e,t,r){if(this.writableEnded){r&&r();return}if(this._data===void 0)this._data=e;else{const s=typeof this._data=="string"?buffer.Buffer.from(this._data,this._encoding||t||"utf8"):this._data,i=typeof e=="string"?buffer.Buffer.from(e,t||this._encoding||"utf8"):e;this._data=buffer.Buffer.concat([s,i])}this._encoding=t,r&&r()}_writev(e,t){}_destroy(e,t){}_final(e){}write(e,t,r){const s=typeof t=="string"?this._encoding:"utf8",i=typeof t=="function"?t:typeof r=="function"?r:void 0;return this._write(e,s,i),!0}setDefaultEncoding(e){return this}end(e,t,r){const s=typeof e=="function"?e:typeof t=="function"?t:typeof r=="function"?r:void 0;if(this.writableEnded)return s&&s(),this;const i=e===s?void 0:e;if(i){const u=t===s?void 0:t;this.write(i,u)}return this.writableEnded=!0,this.writableFinished=!0,this.emit("close"),this.emit("finish"),s&&s(),this}cork(){}uncork(){}destroy(e){return this.destroyed=!0,delete this._data,this.removeAllListeners(),this}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return Promise.resolve()}}const o$2=class{allowHalfOpen=!0;_destroy;constructor(e=new Readable,t=new Writable){Object.assign(this,e),Object.assign(this,t),this._destroy=a(e._destroy,t._destroy)}};function p$1(){return Object.assign(o$2.prototype,Readable.prototype),Object.assign(o$2.prototype,Writable.prototype),o$2}function a(...n){return function(...e){for(const t of n)t(...e)}}const Duplex=p$1();class Socket extends Duplex{__unenv__={};bufferSize=0;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!1;localAddress="";localPort=0;remoteAddress="";remoteFamily="";remotePort=0;autoSelectFamilyAttemptedAddresses=[];readyState="readOnly";constructor(e){super()}write(e,t,r){return!1}connect(e,t,r){return this}end(e,t,r){return this}setEncoding(e){return this}pause(){return this}resume(){return this}setTimeout(e,t){return this}setNoDelay(e){return this}setKeepAlive(e,t){return this}address(){return{}}unref(){return this}ref(){return this}destroySoon(){this.destroy()}resetAndDestroy(){const e=new Error("ERR_SOCKET_CLOSED");return e.code="ERR_SOCKET_CLOSED",this.destroy(e),this}}class IncomingMessage extends Readable{aborted=!1;httpVersion="1.1";httpVersionMajor=1;httpVersionMinor=1;complete=!0;connection;socket;headers={};trailers={};method="GET";url="/";statusCode=200;statusMessage="";closed=!1;errored=null;readable=!1;constructor(e){super(),this.socket=this.connection=e||new Socket}get rawHeaders(){const e=this.headers,t=[];for(const r in e)if(Array.isArray(e[r]))for(const s of e[r])t.push(r,s);else t.push(r,e[r]);return t}get rawTrailers(){return[]}setTimeout(e,t){return this}get headersDistinct(){return o$1(this.headers)}get trailersDistinct(){return o$1(this.trailers)}}function o$1(n){const e={};for(const[t,r]of Object.entries(n))t&&(e[t]=(Array.isArray(r)?r:[r]).filter(Boolean));return e}class ServerResponse extends Writable{statusCode=200;statusMessage="";upgrading=!1;chunkedEncoding=!1;shouldKeepAlive=!1;useChunkedEncodingByDefault=!1;sendDate=!1;finished=!1;headersSent=!1;strictContentLength=!1;connection=null;socket=null;req;_headers={};constructor(e){super(),this.req=e}assignSocket(e){e._httpMessage=this,this.socket=e,this.connection=e,this.emit("socket",e),this._flush()}_flush(){this.flushHeaders()}detachSocket(e){}writeContinue(e){}writeHead(e,t,r){e&&(this.statusCode=e),typeof t=="string"&&(this.statusMessage=t,t=void 0);const s=r||t;if(s&&!Array.isArray(s))for(const i in s)this.setHeader(i,s[i]);return this.headersSent=!0,this}writeProcessing(){}setTimeout(e,t){return this}appendHeader(e,t){e=e.toLowerCase();const r=this._headers[e],s=[...Array.isArray(r)?r:[r],...Array.isArray(t)?t:[t]].filter(Boolean);return this._headers[e]=s.length>1?s:s[0],this}setHeader(e,t){return this._headers[e.toLowerCase()]=t,this}setHeaders(e){for(const[t,r]of Object.entries(e))this.setHeader(t,r);return this}getHeader(e){return this._headers[e.toLowerCase()]}getHeaders(){return this._headers}getHeaderNames(){return Object.keys(this._headers)}hasHeader(e){return e.toLowerCase()in this._headers}removeHeader(e){delete this._headers[e.toLowerCase()]}addTrailers(e){}flushHeaders(){}writeEarlyHints(e,t){typeof t=="function"&&t()}}const NodeHeadersObj=(()=>{const n=function(){};return n.prototype=Object.create(null),n})();function toNodeRequestHeaders(n={}){const e=new NodeHeadersObj,t=Array.isArray(n)||o(n)?n:Object.entries(n);for(const[r,s]of t)if(s){if(e[r]===void 0){e[r]=s;continue}e[r]=[...Array.isArray(e[r])?e[r]:[e[r]],...Array.isArray(s)?s:[s]]}return e}function o(n){return typeof n?.entries=="function"}function toWebResponseHeaders(n={}){if(n instanceof Headers)return n;const e=new Headers;for(const[t,r]of Object.entries(n))if(r!==void 0){if(Array.isArray(r)){for(const s of r)e.append(t,String(s));continue}e.set(t,String(r))}return e}const p=new Set([101,204,205,304]);async function callNodeRequestHandler(n,e){const t=new IncomingMessage,r=new ServerResponse(t);t.url=e.url?.toString()||"/";let s;if(!t.url.startsWith("/")){const d=new URL(t.url);s=d.host,t.url=d.pathname+d.search+d.hash}t.method=e.method||"GET",t.headers=toNodeRequestHeaders(e.headers||{}),t.headers.host||(t.headers.host=e.host||s||"localhost"),t.connection.encrypted=t.connection.encrypted||e.protocol==="https",t.body=e.body||null,t.__unenv__=e.context,await n(t,r);let i=r._data;(p.has(r.statusCode)||t.method.toUpperCase()==="HEAD")&&(i=null,delete r._headers["content-length"]);const u={status:r.statusCode,statusText:r.statusMessage,headers:r._headers,body:i};return t.destroy(),r.destroy(),u}async function fetchNodeRequestHandler(n,e,t={}){try{const r=await callNodeRequestHandler(n,{url:e,...t});return new Response(r.body,{status:r.status,statusText:r.statusText,headers:toWebResponseHeaders(r.headers)})}catch(r){return new Response(r.toString(),{status:Number.parseInt(r.statusCode||r.code)||500,statusText:r.statusText})}}exports.IncomingMessage=IncomingMessage,exports.ServerResponse=ServerResponse,exports.callNodeRequestHandler=callNodeRequestHandler,exports.fetchNodeRequestHandler=fetchNodeRequestHandler;

@@ -1,1 +0,1 @@

import{EventEmitter as f}from"node-mock-http/_polyfill/events";import{Buffer as h}from"node-mock-http/_polyfill/buffer";function o(n){throw new Error(`${n} is not implemented yet!`)}class i extends f{__unenv__={};readableEncoding=null;readableEnded=!0;readableFlowing=!1;readableHighWaterMark=0;readableLength=0;readableObjectMode=!1;readableAborted=!1;readableDidRead=!1;closed=!1;errored=null;readable=!1;destroyed=!1;static from(e,t){return new i(t)}constructor(e){super()}_read(e){}read(e){}setEncoding(e){return this}pause(){return this}resume(){return this}isPaused(){return!0}unpipe(e){return this}unshift(e,t){}wrap(e){return this}push(e,t){return!1}_destroy(e,t){this.removeAllListeners()}destroy(e){return this.destroyed=!0,this._destroy(e),this}pipe(e,t){return{}}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return this.destroy(),Promise.resolve()}async*[Symbol.asyncIterator](){throw o("Readable.asyncIterator")}iterator(e){throw o("Readable.iterator")}map(e,t){throw o("Readable.map")}filter(e,t){throw o("Readable.filter")}forEach(e,t){throw o("Readable.forEach")}reduce(e,t,r){throw o("Readable.reduce")}find(e,t){throw o("Readable.find")}findIndex(e,t){throw o("Readable.findIndex")}some(e,t){throw o("Readable.some")}toArray(e){throw o("Readable.toArray")}every(e,t){throw o("Readable.every")}flatMap(e,t){throw o("Readable.flatMap")}drop(e,t){throw o("Readable.drop")}take(e,t){throw o("Readable.take")}asIndexedPairs(e){throw o("Readable.asIndexedPairs")}}class l extends f{__unenv__={};writable=!0;writableEnded=!1;writableFinished=!1;writableHighWaterMark=0;writableLength=0;writableObjectMode=!1;writableCorked=0;closed=!1;errored=null;writableNeedDrain=!1;writableAborted=!1;destroyed=!1;_data;_encoding="utf8";constructor(e){super()}pipe(e,t){return{}}_write(e,t,r){if(this.writableEnded){r&&r();return}if(this._data===void 0)this._data=e;else{const s=typeof this._data=="string"?h.from(this._data,this._encoding||t||"utf8"):this._data,a=typeof e=="string"?h.from(e,t||this._encoding||"utf8"):e;this._data=h.concat([s,a])}this._encoding=t,r&&r()}_writev(e,t){}_destroy(e,t){}_final(e){}write(e,t,r){const s=typeof t=="string"?this._encoding:"utf8",a=typeof t=="function"?t:typeof r=="function"?r:void 0;return this._write(e,s,a),!0}setDefaultEncoding(e){return this}end(e,t,r){const s=typeof e=="function"?e:typeof t=="function"?t:typeof r=="function"?r:void 0;if(this.writableEnded)return s&&s(),this;const a=e===s?void 0:e;if(a){const u=t===s?void 0:t;this.write(a,u,s)}return this.writableEnded=!0,this.writableFinished=!0,this.emit("close"),this.emit("finish"),this}cork(){}uncork(){}destroy(e){return this.destroyed=!0,delete this._data,this.removeAllListeners(),this}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return Promise.resolve()}}const c=class{allowHalfOpen=!0;_destroy;constructor(e=new i,t=new l){Object.assign(this,e),Object.assign(this,t),this._destroy=m(e._destroy,t._destroy)}};function _(){return Object.assign(c.prototype,i.prototype),Object.assign(c.prototype,l.prototype),c}function m(...n){return function(...e){for(const t of n)t(...e)}}const g=_();class A extends g{__unenv__={};bufferSize=0;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!1;localAddress="";localPort=0;remoteAddress="";remoteFamily="";remotePort=0;autoSelectFamilyAttemptedAddresses=[];readyState="readOnly";constructor(e){super()}write(e,t,r){return!1}connect(e,t,r){return this}end(e,t,r){return this}setEncoding(e){return this}pause(){return this}resume(){return this}setTimeout(e,t){return this}setNoDelay(e){return this}setKeepAlive(e,t){return this}address(){return{}}unref(){return this}ref(){return this}destroySoon(){this.destroy()}resetAndDestroy(){const e=new Error("ERR_SOCKET_CLOSED");return e.code="ERR_SOCKET_CLOSED",this.destroy(e),this}}class y extends i{aborted=!1;httpVersion="1.1";httpVersionMajor=1;httpVersionMinor=1;complete=!0;connection;socket;headers={};trailers={};method="GET";url="/";statusCode=200;statusMessage="";closed=!1;errored=null;readable=!1;constructor(e){super(),this.socket=this.connection=e||new A}get rawHeaders(){const e=this.headers,t=[];for(const r in e)if(Array.isArray(e[r]))for(const s of e[r])t.push(r,s);else t.push(r,e[r]);return t}get rawTrailers(){return[]}setTimeout(e,t){return this}get headersDistinct(){return p(this.headers)}get trailersDistinct(){return p(this.trailers)}}function p(n){const e={};for(const[t,r]of Object.entries(n))t&&(e[t]=(Array.isArray(r)?r:[r]).filter(Boolean));return e}class w extends l{statusCode=200;statusMessage="";upgrading=!1;chunkedEncoding=!1;shouldKeepAlive=!1;useChunkedEncodingByDefault=!1;sendDate=!1;finished=!1;headersSent=!1;strictContentLength=!1;connection=null;socket=null;req;_headers={};constructor(e){super(),this.req=e}assignSocket(e){e._httpMessage=this,this.socket=e,this.connection=e,this.emit("socket",e),this._flush()}_flush(){this.flushHeaders()}detachSocket(e){}writeContinue(e){}writeHead(e,t,r){e&&(this.statusCode=e),typeof t=="string"&&(this.statusMessage=t,t=void 0);const s=r||t;if(s&&!Array.isArray(s))for(const a in s)this.setHeader(a,s[a]);return this.headersSent=!0,this}writeProcessing(){}setTimeout(e,t){return this}appendHeader(e,t){e=e.toLowerCase();const r=this._headers[e],s=[...Array.isArray(r)?r:[r],...Array.isArray(t)?t:[t]].filter(Boolean);return this._headers[e]=s.length>1?s:s[0],this}setHeader(e,t){return this._headers[e.toLowerCase()]=t,this}setHeaders(e){for(const[t,r]of Object.entries(e))this.setHeader(t,r);return this}getHeader(e){return this._headers[e.toLowerCase()]}getHeaders(){return this._headers}getHeaderNames(){return Object.keys(this._headers)}hasHeader(e){return e.toLowerCase()in this._headers}removeHeader(e){delete this._headers[e.toLowerCase()]}addTrailers(e){}flushHeaders(){}writeEarlyHints(e,t){typeof t=="function"&&t()}}const E=(()=>{const n=function(){};return n.prototype=Object.create(null),n})();function R(n={}){const e=new E,t=Array.isArray(n)||H(n)?n:Object.entries(n);for(const[r,s]of t)if(s){if(e[r]===void 0){e[r]=s;continue}e[r]=[...Array.isArray(e[r])?e[r]:[e[r]],...Array.isArray(s)?s:[s]]}return e}function H(n){return typeof n?.entries=="function"}function v(n={}){if(n instanceof Headers)return n;const e=new Headers;for(const[t,r]of Object.entries(n))if(r!==void 0){if(Array.isArray(r)){for(const s of r)e.append(t,String(s));continue}e.set(t,String(r))}return e}const S=new Set([101,204,205,304]);async function b(n,e){const t=new y,r=new w(t);t.url=e.url?.toString()||"/";let s;if(!t.url.startsWith("/")){const d=new URL(t.url);s=d.host,t.url=d.pathname+d.search+d.hash}t.method=e.method||"GET",t.headers=R(e.headers||{}),t.headers.host||(t.headers.host=e.host||s||"localhost"),t.connection.encrypted=t.connection.encrypted||e.protocol==="https",t.body=e.body||null,t.__unenv__=e.context,await n(t,r);let a=r._data;(S.has(r.statusCode)||t.method.toUpperCase()==="HEAD")&&(a=null,delete r._headers["content-length"]);const u={status:r.statusCode,statusText:r.statusMessage,headers:r._headers,body:a};return t.destroy(),r.destroy(),u}async function C(n,e,t={}){try{const r=await b(n,{url:e,...t});return new Response(r.body,{status:r.status,statusText:r.statusText,headers:v(r.headers)})}catch(r){return new Response(r.toString(),{status:Number.parseInt(r.statusCode||r.code)||500,statusText:r.statusText})}}export{y as IncomingMessage,w as ServerResponse,b as callNodeRequestHandler,C as fetchNodeRequestHandler};
import{EventEmitter as f}from"node-mock-http/_polyfill/events";import{Buffer as h}from"node-mock-http/_polyfill/buffer";function o(n){throw new Error(`${n} is not implemented yet!`)}class i extends f{__unenv__={};readableEncoding=null;readableEnded=!0;readableFlowing=!1;readableHighWaterMark=0;readableLength=0;readableObjectMode=!1;readableAborted=!1;readableDidRead=!1;closed=!1;errored=null;readable=!1;destroyed=!1;static from(e,t){return new i(t)}constructor(e){super()}_read(e){}read(e){}setEncoding(e){return this}pause(){return this}resume(){return this}isPaused(){return!0}unpipe(e){return this}unshift(e,t){}wrap(e){return this}push(e,t){return!1}_destroy(e,t){this.removeAllListeners()}destroy(e){return this.destroyed=!0,this._destroy(e),this}pipe(e,t){return{}}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return this.destroy(),Promise.resolve()}async*[Symbol.asyncIterator](){throw o("Readable.asyncIterator")}iterator(e){throw o("Readable.iterator")}map(e,t){throw o("Readable.map")}filter(e,t){throw o("Readable.filter")}forEach(e,t){throw o("Readable.forEach")}reduce(e,t,r){throw o("Readable.reduce")}find(e,t){throw o("Readable.find")}findIndex(e,t){throw o("Readable.findIndex")}some(e,t){throw o("Readable.some")}toArray(e){throw o("Readable.toArray")}every(e,t){throw o("Readable.every")}flatMap(e,t){throw o("Readable.flatMap")}drop(e,t){throw o("Readable.drop")}take(e,t){throw o("Readable.take")}asIndexedPairs(e){throw o("Readable.asIndexedPairs")}}class l extends f{__unenv__={};writable=!0;writableEnded=!1;writableFinished=!1;writableHighWaterMark=0;writableLength=0;writableObjectMode=!1;writableCorked=0;closed=!1;errored=null;writableNeedDrain=!1;writableAborted=!1;destroyed=!1;_data;_encoding="utf8";constructor(e){super()}pipe(e,t){return{}}_write(e,t,r){if(this.writableEnded){r&&r();return}if(this._data===void 0)this._data=e;else{const s=typeof this._data=="string"?h.from(this._data,this._encoding||t||"utf8"):this._data,a=typeof e=="string"?h.from(e,t||this._encoding||"utf8"):e;this._data=h.concat([s,a])}this._encoding=t,r&&r()}_writev(e,t){}_destroy(e,t){}_final(e){}write(e,t,r){const s=typeof t=="string"?this._encoding:"utf8",a=typeof t=="function"?t:typeof r=="function"?r:void 0;return this._write(e,s,a),!0}setDefaultEncoding(e){return this}end(e,t,r){const s=typeof e=="function"?e:typeof t=="function"?t:typeof r=="function"?r:void 0;if(this.writableEnded)return s&&s(),this;const a=e===s?void 0:e;if(a){const u=t===s?void 0:t;this.write(a,u)}return this.writableEnded=!0,this.writableFinished=!0,this.emit("close"),this.emit("finish"),s&&s(),this}cork(){}uncork(){}destroy(e){return this.destroyed=!0,delete this._data,this.removeAllListeners(),this}compose(e,t){throw new Error("Method not implemented.")}[Symbol.asyncDispose](){return Promise.resolve()}}const c=class{allowHalfOpen=!0;_destroy;constructor(e=new i,t=new l){Object.assign(this,e),Object.assign(this,t),this._destroy=m(e._destroy,t._destroy)}};function _(){return Object.assign(c.prototype,i.prototype),Object.assign(c.prototype,l.prototype),c}function m(...n){return function(...e){for(const t of n)t(...e)}}const g=_();class A extends g{__unenv__={};bufferSize=0;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!1;localAddress="";localPort=0;remoteAddress="";remoteFamily="";remotePort=0;autoSelectFamilyAttemptedAddresses=[];readyState="readOnly";constructor(e){super()}write(e,t,r){return!1}connect(e,t,r){return this}end(e,t,r){return this}setEncoding(e){return this}pause(){return this}resume(){return this}setTimeout(e,t){return this}setNoDelay(e){return this}setKeepAlive(e,t){return this}address(){return{}}unref(){return this}ref(){return this}destroySoon(){this.destroy()}resetAndDestroy(){const e=new Error("ERR_SOCKET_CLOSED");return e.code="ERR_SOCKET_CLOSED",this.destroy(e),this}}class y extends i{aborted=!1;httpVersion="1.1";httpVersionMajor=1;httpVersionMinor=1;complete=!0;connection;socket;headers={};trailers={};method="GET";url="/";statusCode=200;statusMessage="";closed=!1;errored=null;readable=!1;constructor(e){super(),this.socket=this.connection=e||new A}get rawHeaders(){const e=this.headers,t=[];for(const r in e)if(Array.isArray(e[r]))for(const s of e[r])t.push(r,s);else t.push(r,e[r]);return t}get rawTrailers(){return[]}setTimeout(e,t){return this}get headersDistinct(){return p(this.headers)}get trailersDistinct(){return p(this.trailers)}}function p(n){const e={};for(const[t,r]of Object.entries(n))t&&(e[t]=(Array.isArray(r)?r:[r]).filter(Boolean));return e}class w extends l{statusCode=200;statusMessage="";upgrading=!1;chunkedEncoding=!1;shouldKeepAlive=!1;useChunkedEncodingByDefault=!1;sendDate=!1;finished=!1;headersSent=!1;strictContentLength=!1;connection=null;socket=null;req;_headers={};constructor(e){super(),this.req=e}assignSocket(e){e._httpMessage=this,this.socket=e,this.connection=e,this.emit("socket",e),this._flush()}_flush(){this.flushHeaders()}detachSocket(e){}writeContinue(e){}writeHead(e,t,r){e&&(this.statusCode=e),typeof t=="string"&&(this.statusMessage=t,t=void 0);const s=r||t;if(s&&!Array.isArray(s))for(const a in s)this.setHeader(a,s[a]);return this.headersSent=!0,this}writeProcessing(){}setTimeout(e,t){return this}appendHeader(e,t){e=e.toLowerCase();const r=this._headers[e],s=[...Array.isArray(r)?r:[r],...Array.isArray(t)?t:[t]].filter(Boolean);return this._headers[e]=s.length>1?s:s[0],this}setHeader(e,t){return this._headers[e.toLowerCase()]=t,this}setHeaders(e){for(const[t,r]of Object.entries(e))this.setHeader(t,r);return this}getHeader(e){return this._headers[e.toLowerCase()]}getHeaders(){return this._headers}getHeaderNames(){return Object.keys(this._headers)}hasHeader(e){return e.toLowerCase()in this._headers}removeHeader(e){delete this._headers[e.toLowerCase()]}addTrailers(e){}flushHeaders(){}writeEarlyHints(e,t){typeof t=="function"&&t()}}const E=(()=>{const n=function(){};return n.prototype=Object.create(null),n})();function R(n={}){const e=new E,t=Array.isArray(n)||H(n)?n:Object.entries(n);for(const[r,s]of t)if(s){if(e[r]===void 0){e[r]=s;continue}e[r]=[...Array.isArray(e[r])?e[r]:[e[r]],...Array.isArray(s)?s:[s]]}return e}function H(n){return typeof n?.entries=="function"}function v(n={}){if(n instanceof Headers)return n;const e=new Headers;for(const[t,r]of Object.entries(n))if(r!==void 0){if(Array.isArray(r)){for(const s of r)e.append(t,String(s));continue}e.set(t,String(r))}return e}const S=new Set([101,204,205,304]);async function b(n,e){const t=new y,r=new w(t);t.url=e.url?.toString()||"/";let s;if(!t.url.startsWith("/")){const d=new URL(t.url);s=d.host,t.url=d.pathname+d.search+d.hash}t.method=e.method||"GET",t.headers=R(e.headers||{}),t.headers.host||(t.headers.host=e.host||s||"localhost"),t.connection.encrypted=t.connection.encrypted||e.protocol==="https",t.body=e.body||null,t.__unenv__=e.context,await n(t,r);let a=r._data;(S.has(r.statusCode)||t.method.toUpperCase()==="HEAD")&&(a=null,delete r._headers["content-length"]);const u={status:r.statusCode,statusText:r.statusMessage,headers:r._headers,body:a};return t.destroy(),r.destroy(),u}async function C(n,e,t={}){try{const r=await b(n,{url:e,...t});return new Response(r.body,{status:r.status,statusText:r.statusText,headers:v(r.headers)})}catch(r){return new Response(r.toString(),{status:Number.parseInt(r.statusCode||r.code)||500,statusText:r.statusText})}}export{y as IncomingMessage,w as ServerResponse,b as callNodeRequestHandler,C as fetchNodeRequestHandler};
{
"name": "node-mock-http",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -45,3 +45,3 @@ "repository": "unjs/node-mock-http",

"prepack": "pnpm build",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"release": "pnpm test && pnpm build && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",

@@ -51,15 +51,15 @@ "test:types": "tsc --noEmit --skipLibCheck"

"devDependencies": {
"@types/node": "^24.10.1",
"@vitest/coverage-v8": "^4.0.15",
"automd": "^0.4.2",
"@types/node": "^24",
"@vitest/coverage-v8": "^4.1.10",
"automd": "^0.4.3",
"changelogen": "^0.6.2",
"eslint": "^9.39.1",
"eslint-config-unjs": "^0.5.0",
"jiti": "^2.6.1",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"eslint": "^10.8.0",
"eslint-config-unjs": "^0.6.2",
"jiti": "^2.7.0",
"prettier": "^3.9.6",
"typescript": "^6.0.3",
"unbuild": "^3.6.1",
"vitest": "^4.0.15"
"vitest": "^4.1.10"
},
"packageManager": "pnpm@10.24.0"
"packageManager": "pnpm@11.17.0"
}