File: /var/www/quadcode.com/build/server/chunks/index-d9e8b680.js
class o{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`};}toString(){return JSON.stringify(this.body)}}class c{constructor(t,n){this.status=t,this.location=n;}}class i{constructor(t,n){this.status=t,this.data=n;}}function a(e,t){if(isNaN(e)||e<400||e>599)throw new Error(`HTTP error status codes must be between 400 and 599 — ${e} is invalid`);return new o(e,t)}function h(e,t){if(isNaN(e)||e<300||e>308)throw new Error("Invalid status code");return new c(e,t.toString())}function d(e,t){const n=JSON.stringify(e),r=new Headers(t?.headers);return r.has("content-length")||r.set("content-length",s.encode(n).byteLength.toString()),r.has("content-type")||r.set("content-type","application/json"),new Response(n,{...t,headers:r})}const s=new TextEncoder;function g(e,t){const n=new Headers(t?.headers);if(!n.has("content-length")){const r=s.encode(e);return n.set("content-length",r.byteLength.toString()),new Response(r,{...t,headers:n})}return new Response(e,{...t,headers:n})}
export { a, c, d, g, h, i, o };
//# sourceMappingURL=index-d9e8b680.js.map