Skip to content

Commit 1b924e7

Browse files
authored
chore(browser): Rename UserAgent integration to HttpContext (#5027)
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.
1 parent add82b4 commit 1b924e7

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

MIGRATION.md

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ For our efforts to reduce bundle size of the SDK we had to remove and refactor p
281281
not present in other Sentry SDKs. For the sake of reducing complexity, increasing consistency with other Sentry SDKs and
282282
decreasing bundle-size, `Backend` was removed.
283283
- Remove support for Opera browser pre v15
284+
- Rename `UserAgent` integration to `HttpContext` (see [#5027](https://github.com/getsentry/sentry-javascript/pull/5027))
284285

285286
## Sentry Angular SDK Changes
286287

packages/browser/src/integrations/useragent.ts renamed to packages/browser/src/integrations/httpcontext.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ import { getGlobalObject } from '@sentry/utils';
44

55
const global = getGlobalObject<Window>();
66

7-
/** UserAgent */
8-
export class UserAgent implements Integration {
7+
/** HttpContext integration collects information about HTTP request headers */
8+
export class HttpContext implements Integration {
99
/**
1010
* @inheritDoc
1111
*/
12-
public static id: string = 'UserAgent';
12+
public static id: string = 'HttpContext';
1313

1414
/**
1515
* @inheritDoc
1616
*/
17-
public name: string = UserAgent.id;
17+
public name: string = HttpContext.id;
1818

1919
/**
2020
* @inheritDoc
2121
*/
2222
public setupOnce(): void {
2323
addGlobalEventProcessor((event: Event) => {
24-
if (getCurrentHub().getIntegration(UserAgent)) {
24+
if (getCurrentHub().getIntegration(HttpContext)) {
2525
// if none of the information we want exists, don't bother
2626
if (!global.navigator && !global.location && !global.document) {
2727
return event;

packages/browser/src/integrations/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export { GlobalHandlers } from './globalhandlers';
22
export { TryCatch } from './trycatch';
33
export { Breadcrumbs } from './breadcrumbs';
44
export { LinkedErrors } from './linkederrors';
5-
export { UserAgent } from './useragent';
5+
export { HttpContext } from './httpcontext';
66
export { Dedupe } from './dedupe';

packages/browser/src/sdk.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { BrowserClient, BrowserClientOptions, BrowserOptions } from './client';
1919
import { IS_DEBUG_BUILD } from './flags';
2020
import { ReportDialogOptions, wrap as internalWrap } from './helpers';
21-
import { Breadcrumbs, Dedupe, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';
21+
import { Breadcrumbs, Dedupe, GlobalHandlers, HttpContext, LinkedErrors, TryCatch } from './integrations';
2222
import { defaultStackParser } from './stack-parsers';
2323
import { makeFetchTransport, makeXHRTransport } from './transports';
2424

@@ -30,7 +30,7 @@ export const defaultIntegrations = [
3030
new GlobalHandlers(),
3131
new LinkedErrors(),
3232
new Dedupe(),
33-
new UserAgent(),
33+
new HttpContext(),
3434
];
3535

3636
/**

0 commit comments

Comments
 (0)