%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/node_modules/src/integrations/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/node_modules/src/integrations/httpcontext.ts

import type { Event, Integration } from '@sentry/types';

import { WINDOW } from '../helpers';

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

  /**
   * @inheritDoc
   */
  public name: string;

  public constructor() {
    this.name = HttpContext.id;
  }

  /**
   * @inheritDoc
   */
  public setupOnce(): void {
    // noop
  }

  /** @inheritDoc */
  public preprocessEvent(event: Event): void {
    // if none of the information we want exists, don't bother
    if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {
      return;
    }

    // grab as much info as exists and add it to the event
    const url = (event.request && event.request.url) || (WINDOW.location && WINDOW.location.href);
    const { referrer } = WINDOW.document || {};
    const { userAgent } = WINDOW.navigator || {};

    const headers = {
      ...(event.request && event.request.headers),
      ...(referrer && { Referer: referrer }),
      ...(userAgent && { 'User-Agent': userAgent }),
    };
    const request = { ...event.request, ...(url && { url }), headers };

    event.request = request;
  }
}

Zerion Mini Shell 1.0