@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 719 B
JavaScript
const e=async(e,t)=>{if(!e.body)return await t(),e;let n=e.body.getReader(),r=!1,i=async()=>{r||(r=!0,await t())},a=new ReadableStream({async pull(e){try{let t=await n.read();if(t.done){e.close(),await i();return}e.enqueue(t.value)}catch(t){e.error(t),await i()}},async cancel(e){try{await n.cancel(e)}finally{await i()}}}),o=new Response(a,{status:e.status,statusText:e.statusText,headers:e.headers});for(let t of Object.getOwnPropertyNames(e)){let n=Object.getOwnPropertyDescriptor(e,t);n&&Object.defineProperty(o,t,n)}for(let t of[`redirected`,`type`,`url`])Object.hasOwn(o,t)||Object.defineProperty(o,t,{configurable:!0,value:e[t]});return o};export{e as default};
//# sourceMappingURL=with-response-cleanup.mjs.map