UNPKG

@sentry/nextjs

Version:
32 lines (28 loc) • 1.21 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const attributes = require('@sentry/conventions/attributes'); function getNormalizedRequestFromAttributes(attributes$1) { const method = attributes$1[attributes.HTTP_REQUEST_METHOD] || attributes$1[attributes.HTTP_METHOD]; const url = attributes$1[attributes.URL_FULL] || attributes$1[attributes.URL_PATH] || attributes$1[attributes.HTTP_TARGET]; if (typeof method !== "string" && typeof url !== "string") { return void 0; } const normalizedRequest = {}; if (typeof method === "string") { normalizedRequest.method = method; } if (typeof url === "string") { normalizedRequest.url = url; const queryFromAttribute = attributes$1[attributes.URL_QUERY]; if (typeof queryFromAttribute === "string") { normalizedRequest.query_string = queryFromAttribute; } else { const queryIndex = url.indexOf("?"); if (queryIndex !== -1) { normalizedRequest.query_string = url.slice(queryIndex + 1); } } } return normalizedRequest; } exports.getNormalizedRequestFromAttributes = getNormalizedRequestFromAttributes; //# sourceMappingURL=getNormalizedRequestFromAttributes.js.map