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

Function getUrlFromResource

packages/core/src/instrument/fetch.ts:232–250  ·  view source on GitHub ↗
(resource: FetchResource)

Source from the content-addressed store, hash-verified

230}
231
232function getUrlFromResource(resource: FetchResource): string {
233 if (typeof resource === 'string') {
234 return resource;
235 }
236
237 if (!resource) {
238 return '';
239 }
240
241 if (hasProp(resource, 'url')) {
242 return resource.url;
243 }
244
245 if (resource.toString) {
246 return resource.toString();
247 }
248
249 return '';
250}
251
252/**
253 * Parses the fetch arguments to find the used Http method and the url of the request.

Callers 1

parseFetchArgsFunction · 0.85

Calls 2

hasPropFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected