Skip to content

Commit

Permalink
chore(browser): Rename UserAgent integration to HttpContext (#5027)
Browse files Browse the repository at this point in the history
As suggested in this [comment](#2906 (comment)) of #2906, rename the Browser `UserAgent` integration to `HttpContext`. The integration does more than collecting the user agent information and thus the old name wasn't reflecting its entire purpose.
  • Loading branch information
Lms24 authored and AbhiPrasad committed May 30, 2022
1 parent 649ac57 commit 8020d8a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,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

0 comments on commit 8020d8a

Please sign in to comment.