@gam-test/fetch-wrapper
Version:
A simple fetch wrapper for better error handling and less response context
2 lines • 421 B
JavaScript
import{a as s}from"./chunk-4L5ZPVAE.js";import{a as e}from"./chunk-M4G7TNUM.js";var r=class extends e{async connect(o){let t=await fetch(`${this.url}`,{...o,method:"HEAD"}),n=s.get(t.status);if(n&&o?.throwOnConnectionFailure){let i=await t.json().catch(()=>"Request response with non json body");throw new n({url:this.url,payload:null,responseBody:i})}return t}};export{r as a};
//# sourceMappingURL=chunk-Y6M5DMXN.js.map