# CICADA

### File

`src/app/_interceptors/http-config.interceptor.ts`

### Description

Intercepts and handles setting of configurations to outgoing HTTP request.

### Index

###### Methods

- intercept

### Constructor

`constructor()`
Defined in src/app/_interceptors/http-config.interceptor.ts:10
Initialization of http config interceptor.

### Methods

intercept
`intercept(request: HttpRequest<unknown>, next: HttpHandler)`
Defined in src/app/_interceptors/http-config.interceptor.ts:21

Intercepts HTTP requests.

Parameters :

Name | Type | Optional | Description

request

`HttpRequest<unknown>`

No

- An outgoing HTTP request with an optional typed body.

next

`HttpHandler`

No

- The next HTTP handler or the outgoing request dispatcher.

Returns : `Observable<HttpEvent<unknown>>`

The forwarded request.

    import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
    import { Injectable } from '@angular/core';

    // Third party imports
    import { Observable } from 'rxjs';

    /** Intercepts and handles setting of configurations to outgoing HTTP request. */
    @Injectable()
    export class HttpConfigInterceptor implements HttpInterceptor {
      /** Initialization of http config interceptor. */
      constructor() {}

      /**
       * Intercepts HTTP requests.
       *
       * @param request - An outgoing HTTP request with an optional typed body.
       * @param next - The next HTTP handler or the outgoing request dispatcher.
       * @returns The forwarded request.
       */
      intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
        // const token: string = sessionStorage.getItem(btoa('CICADA_SESSION_TOKEN'));

        // if (token) {
        //   request = request.clone({headers: request.headers.set('Authorization', 'Bearer ' + token)});
        // }

        return next.handle(request);
      }
    }

# result-matching ""

# No results matching ""