Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exceptionless/fetchclient

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exceptionless/fetchclient - npm Package Compare versions

Comparing version 0.37.0 to 0.38.0

43

esm/src/FetchClient.js

@@ -344,5 +344,21 @@ import { Counter } from "./Counter.js";

this.#provider.counter.increment();
let request = null;
try {
request = new Request(url, init);
}
catch {
// try converting to absolute URL
const origin = globalThis.location?.origin ?? "http://localhost";
if (!url.startsWith("http")) {
if (url.startsWith("/")) {
request = new Request(origin + url, init);
}
else {
request = new Request(origin + url, init);
}
}
}
const context = {
options,
request: new Request(url, init),
request: request,
response: null,

@@ -444,13 +460,16 @@ meta: {},

buildUrl(url, options) {
if (url.startsWith("/")) {
url = url.substring(1);
let builtUrl = url;
if (!builtUrl.startsWith("http") && this.options?.baseUrl) {
if (this.options.baseUrl.endsWith("/") || builtUrl.startsWith("/")) {
builtUrl = this.options.baseUrl + builtUrl;
}
else {
builtUrl = this.options.baseUrl + "/" + builtUrl;
}
}
if (!url.startsWith("http") && this.options?.baseUrl) {
url = this.options.baseUrl + "/" + url;
}
const isAbsoluteUrl = url.startsWith("http");
const isAbsoluteUrl = builtUrl.startsWith("http");
const origin = isAbsoluteUrl
? undefined
: globalThis.location?.origin ?? undefined;
const parsed = new URL(url, origin);
: globalThis.location?.origin ?? "http://localhost";
const parsed = new URL(builtUrl, origin);
if (options?.params) {

@@ -462,5 +481,7 @@ for (const [key, value] of Object.entries(options?.params)) {

}
url = parsed.toString();
builtUrl = parsed.toString();
}
const result = isAbsoluteUrl ? url : `${parsed.pathname}${parsed.search}`;
const result = isAbsoluteUrl
? builtUrl
: `${parsed.pathname}${parsed.search}`;
return result;

@@ -467,0 +488,0 @@ }

{
"name": "@exceptionless/fetchclient",
"version": "0.37.0",
"version": "0.38.0",
"description": "A simple fetch client with middleware support for Deno and the browser.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -347,5 +347,21 @@ "use strict";

this.#provider.counter.increment();
let request = null;
try {
request = new Request(url, init);
}
catch {
// try converting to absolute URL
const origin = globalThis.location?.origin ?? "http://localhost";
if (!url.startsWith("http")) {
if (url.startsWith("/")) {
request = new Request(origin + url, init);
}
else {
request = new Request(origin + url, init);
}
}
}
const context = {
options,
request: new Request(url, init),
request: request,
response: null,

@@ -447,13 +463,16 @@ meta: {},

buildUrl(url, options) {
if (url.startsWith("/")) {
url = url.substring(1);
let builtUrl = url;
if (!builtUrl.startsWith("http") && this.options?.baseUrl) {
if (this.options.baseUrl.endsWith("/") || builtUrl.startsWith("/")) {
builtUrl = this.options.baseUrl + builtUrl;
}
else {
builtUrl = this.options.baseUrl + "/" + builtUrl;
}
}
if (!url.startsWith("http") && this.options?.baseUrl) {
url = this.options.baseUrl + "/" + url;
}
const isAbsoluteUrl = url.startsWith("http");
const isAbsoluteUrl = builtUrl.startsWith("http");
const origin = isAbsoluteUrl
? undefined
: globalThis.location?.origin ?? undefined;
const parsed = new URL(url, origin);
: globalThis.location?.origin ?? "http://localhost";
const parsed = new URL(builtUrl, origin);
if (options?.params) {

@@ -465,5 +484,7 @@ for (const [key, value] of Object.entries(options?.params)) {

}
url = parsed.toString();
builtUrl = parsed.toString();
}
const result = isAbsoluteUrl ? url : `${parsed.pathname}${parsed.search}`;
const result = isAbsoluteUrl
? builtUrl
: `${parsed.pathname}${parsed.search}`;
return result;

@@ -470,0 +491,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc