UNPKG

@gam-test/fetch-wrapper

Version:

A simple fetch wrapper for better error handling and less response context

2 lines 420 B
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:"GET"}),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-INNHLF44.js.map