MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / extractQueryParamsFromUrl

Function extractQueryParamsFromUrl

packages/core/src/utils/request.ts:369–383  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

367
368/** Extract the query params from an URL. */
369export function extractQueryParamsFromUrl(url: string): string | undefined {
370 // url is path and query string
371 if (!url) {
372 return;
373 }
374
375 try {
376 // The `URL` constructor can't handle internal URLs of the form `/some/path/here`, so stick a dummy protocol and
377 // hostname as the base. Since the point here is just to grab the query string, it doesn't matter what we use.
378 const queryParams = new URL(url, 'http://s.io').search.slice(1);
379 return queryParams.length ? queryParams : undefined;
380 } catch {
381 return undefined;
382 }
383}

Callers 3

request.test.tsFile · 0.90
httpRequestToRequestDataFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected