Skip to content

feat(browser): Remove HttpContext integration class #10987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions packages/browser/src/integrations/httpcontext.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
import type { Event, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';

import { defineIntegration } from '@sentry/core';
import { WINDOW } from '../helpers';

const INTEGRATION_NAME = 'HttpContext';

const _httpContextIntegration = (() => {
/**
* Collects information about HTTP request headers and
* attaches them to the event.
*/
export const httpContextIntegration = defineIntegration(() => {
return {
name: INTEGRATION_NAME,
name: 'HttpContext',
preprocessEvent(event) {
// if none of the information we want exists, don't bother
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {
Expand All @@ -29,15 +29,4 @@ const _httpContextIntegration = (() => {
event.request = request;
},
};
}) satisfies IntegrationFn;

export const httpContextIntegration = defineIntegration(_httpContextIntegration);

/**
* HttpContext integration collects information about HTTP request headers.
* @deprecated Use `httpContextIntegration()` instead.
*/
// eslint-disable-next-line deprecation/deprecation
export const HttpContext = convertIntegrationFnToClass(INTEGRATION_NAME, httpContextIntegration) as IntegrationClass<
Integration & { preprocessEvent: (event: Event) => void }
>;
});