@sailfish-ai/recorder 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -225,7 +225,6 @@ function setupFetchInterceptor(domainsToNotPropagateHeaderTo, domainsToPropagate
225
225
  }
226
226
  else {
227
227
  // Unsupported input type, skip interception
228
- console.warn("Unsupported input type for fetch:", input);
229
228
  return originalFetch.apply(this, arguments);
230
229
  }
231
230
  // Bypass logic for domains listed in the combinedIgnoreDomains
@@ -235,10 +234,13 @@ function setupFetchInterceptor(domainsToNotPropagateHeaderTo, domainsToPropagate
235
234
  // Check if the domain should propagate headers
236
235
  const shouldPropagateHeader = domainsToPropagateHeadersTo.length === 0 ||
237
236
  matchUrlWithWildcard(url, domainsToPropagateHeadersTo);
238
- // Proceed with fetch if header should propagate and not be excluded
237
+ // ** Skip CORS-sensitive requests **
238
+ // Ensure we don't modify headers for cross-origin requests to non-whitelisted domains
239
+ if (!shouldPropagateHeader) {
240
+ return originalFetch.apply(this, arguments);
241
+ }
239
242
  if (sessionId && shouldPropagateHeader) {
240
243
  if (input instanceof Request) {
241
- // If input is a Request, clone it and modify the headers
242
244
  const clonedRequest = input.clone();
243
245
  const newHeaders = new Headers(clonedRequest.headers);
244
246
  newHeaders.set("X-Sf3-Rid", sessionId);
@@ -248,7 +250,6 @@ function setupFetchInterceptor(domainsToNotPropagateHeaderTo, domainsToPropagate
248
250
  return originalFetch.call(this, modifiedRequest);
249
251
  }
250
252
  else {
251
- // For string or URL input, modify init to add headers
252
253
  const modifiedInit = { ...init };
253
254
  const newHeaders = new Headers(init?.headers || {});
254
255
  newHeaders.set("X-Sf3-Rid", sessionId);