diff --git a/package.json b/package.json index 3670c4e..c7e1e80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.14.9", + "version": "0.14.10", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/http.ts b/src/http.ts index 0f42702..0477d5c 100644 --- a/src/http.ts +++ b/src/http.ts @@ -104,18 +104,13 @@ export class Http { } }); - const data = new Response(stream); - resp.blob = data.blob; - resp.formData = data.formData; - resp.json = data.json; - resp.text = data.text; - + resp.data = new Response(stream); if(opts.decode !== false) { const content = resp.headers.get('Content-Type')?.toLowerCase(); - if(content?.includes('application')) resp.data = await data.blob(); - else if(content?.includes('form')) resp.data = await data.formData(); - else if(content?.includes('json')) resp.data = await data.json(); - else if(content?.includes('text')) resp.data = await data.text(); + if(content?.includes('application')) resp.data = await resp.data.blob(); + else if(content?.includes('form')) resp.data = await resp.data.formData(); + else if(content?.includes('json')) resp.data = await resp.data.json(); + else if(content?.includes('text')) resp.data = await resp.data.text(); } if(resp.ok) res(resp);