From ffaf8558b2927bc8d232379a56dd36c1e615ac16 Mon Sep 17 00:00:00 2001 From: ztimson Date: Wed, 7 Feb 2024 23:14:37 -0500 Subject: [PATCH] Fixed xhr --- package.json | 3 ++- src/xhr.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 688730c..efe66c5 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "@ztimson/js-utilities", - "version": "0.0.0", + "version": "0.1.0", "description": "JavaScript Utility library", "author": "Zak Timson", "license": "MIT", + "private": false, "repository": { "type": "git", "url": "https://git.zakscode.com/ztimson/js-utilities" diff --git a/src/xhr.ts b/src/xhr.ts index a8a2ae7..733e0cf 100644 --- a/src/xhr.ts +++ b/src/xhr.ts @@ -45,7 +45,7 @@ export class XHR { return fetch(`${this.baseUrl}${href || ''}`.replace(/([^:]\/)\/+/g, '$1'), { headers, method: opts.method || (body ? 'POST' : 'GET'), - body: (headers['Content-Type'].startsWith('application/json') && body) ? JSON.stringify(body) : body + body: (headers['Content-Type']?.startsWith('application/json') && body) ? JSON.stringify(body) : body }).then(async resp => { for(let fn of this.getInterceptors()) { const wait = new Promise(res =>