@sentry/nextjs
Version:
Official Sentry SDK for Next.js
24 lines (20 loc) • 815 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const core = require('@sentry/core');
function addHeadersAsAttributes(headers, span) {
if (!headers) {
return {};
}
const client = core.getClient();
const dataCollection = client?.getDataCollectionOptions();
if (dataCollection?.httpHeaders.request === false) {
return {};
}
const headersDict = headers instanceof Headers || typeof headers === "object" && "get" in headers ? core.winterCGHeadersToDict(headers) : headers;
const headerAttributes = core.httpHeadersToSpanAttributes(headersDict, dataCollection ?? false);
if (span) {
span.setAttributes(headerAttributes);
}
return headerAttributes;
}
exports.addHeadersAsAttributes = addHeadersAsAttributes;
//# sourceMappingURL=addHeadersAsAttributes.js.map