Skip to content

chore(browser): Rename UserAgent integration to HttpContext #5027

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
May 4, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ For our efforts to reduce bundle size of the SDK we had to remove and refactor p
not present in other Sentry SDKs. For the sake of reducing complexity, increasing consistency with other Sentry SDKs and
decreasing bundle-size, `Backend` was removed.
- Remove support for Opera browser pre v15
- Rename `UserAgent` integration to `HttpContext` (see [#5027](https://github.com/getsentry/sentry-javascript/pull/5027))

## Sentry Angular SDK Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import { getGlobalObject } from '@sentry/utils';

const global = getGlobalObject<Window>();

/** UserAgent */
export class UserAgent implements Integration {
/** HttpContext integration collects information about HTTP request headers */
export class HttpContext implements Integration {
/**
* @inheritDoc
*/
public static id: string = 'UserAgent';
public static id: string = 'HttpContext';

/**
* @inheritDoc
*/
public name: string = UserAgent.id;
public name: string = HttpContext.id;

/**
* @inheritDoc
*/
public setupOnce(): void {
addGlobalEventProcessor((event: Event) => {
if (getCurrentHub().getIntegration(UserAgent)) {
if (getCurrentHub().getIntegration(HttpContext)) {
// if none of the information we want exists, don't bother
if (!global.navigator && !global.location && !global.document) {
return event;
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export { GlobalHandlers } from './globalhandlers';
export { TryCatch } from './trycatch';
export { Breadcrumbs } from './breadcrumbs';
export { LinkedErrors } from './linkederrors';
export { UserAgent } from './useragent';
export { HttpContext } from './httpcontext';
export { Dedupe } from './dedupe';
4 changes: 2 additions & 2 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { BrowserClient, BrowserClientOptions, BrowserOptions } from './client';
import { IS_DEBUG_BUILD } from './flags';
import { ReportDialogOptions, wrap as internalWrap } from './helpers';
import { Breadcrumbs, Dedupe, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';
import { Breadcrumbs, Dedupe, GlobalHandlers, HttpContext, LinkedErrors, TryCatch } from './integrations';
import { defaultStackParser } from './stack-parsers';
import { makeFetchTransport, makeXHRTransport } from './transports';

Expand All @@ -30,7 +30,7 @@ export const defaultIntegrations = [
new GlobalHandlers(),
new LinkedErrors(),
new Dedupe(),
new UserAgent(),
new HttpContext(),
];

/**
Expand Down