UNPKG

miniflare

Version:

Fun, full-featured, fully-local simulator for Cloudflare Workers

1 lines 790 B
import{E as e,N as t}from"./useRouterState-DkU0JPAO.js";function n(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function r(e){return!!e?.isNotFound}var i=`__root__`;function a(n){if(n.statusCode=n.statusCode||n.code||307,!n._builtLocation&&typeof n.href==`string`&&t(n.href))throw Error(`Redirect blocked: unsafe protocol in href "${n.href}". Only ${e.join(`, `)} protocols are allowed.`);if(!n._builtLocation&&!n.reloadDocument&&typeof n.href==`string`)try{new URL(n.href),n.reloadDocument=!0}catch{}let r=new Headers(n.headers);n.href&&r.get(`Location`)===null&&r.set(`Location`,n.href);let i=new Response(null,{status:n.statusCode,headers:r});if(i.options=n,n.throw)throw i;return i}function o(e){return e instanceof Response&&!!e.options}export{n as a,r as i,a as n,i as r,o as t};