UNPKG

@sentry/nextjs

Version:
22 lines (19 loc) 760 B
import { getClient, winterCGHeadersToDict, httpHeadersToSpanAttributes } from '@sentry/core'; function addHeadersAsAttributes(headers, span) { if (!headers) { return {}; } const client = getClient(); const dataCollection = client?.getDataCollectionOptions(); if (dataCollection?.httpHeaders.request === false) { return {}; } const headersDict = headers instanceof Headers || typeof headers === "object" && "get" in headers ? winterCGHeadersToDict(headers) : headers; const headerAttributes = httpHeadersToSpanAttributes(headersDict, dataCollection ?? false); if (span) { span.setAttributes(headerAttributes); } return headerAttributes; } export { addHeadersAsAttributes }; //# sourceMappingURL=addHeadersAsAttributes.js.map