Fixed xhr
Some checks failed
Build / Build NPM Project (push) Failing after 0s
Build / Tag Version (push) Has been skipped
Build / Publish (push) Has been skipped

This commit is contained in:
Zakary Timson 2024-04-12 20:40:10 -04:00
parent be8c297c47
commit 86d2d34615
3 changed files with 4 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@ztimson/utils",
"version": "0.2.2",
"version": "0.2.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@ztimson/utils",
"version": "0.2.2",
"version": "0.2.3",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.12",

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/utils",
"version": "0.2.2",
"version": "0.2.3",
"description": "Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@ -46,7 +46,7 @@ export class XHR {
async request<T>(opts: RequestOptions = {}): Promise<T> {
if(!this.opts.url && !opts.url) throw new Error('URL needs to be set');
const url = (opts.url?.startsWith('http') ? opts.url : (this.opts.url || '') + opts.url).replace(/([^:]\/)\/+/g, '$1');
const url = (opts.url?.startsWith('http') ? opts.url : (this.opts.url || '') + (opts.url || '')).replace(/([^:]\/)\/+/g, '$1');
// Prep headers
const headers = <any>clean({