Fixed xhr
This commit is contained in:
parent
be8c297c47
commit
86d2d34615
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -46,7 +46,7 @@ export class XHR {
|
|||||||
|
|
||||||
async request<T>(opts: RequestOptions = {}): Promise<T> {
|
async request<T>(opts: RequestOptions = {}): Promise<T> {
|
||||||
if(!this.opts.url && !opts.url) throw new Error('URL needs to be set');
|
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
|
// Prep headers
|
||||||
const headers = <any>clean({
|
const headers = <any>clean({
|
||||||
|
Loading…
Reference in New Issue
Block a user