---
url: /nestjs-odata/api/generated/classes/ODataRequestContextInterceptor.md
---
# Class: ODataRequestContextInterceptor

Defined in: [context/odata-request-context.ts:53](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/context/odata-request-context.ts#L53)

Global interceptor, registered by `ODataModule.forRoot()` / `forRootAsync()`, that makes the
current `ExecutionContext` and request available through [getODataRequestContext](../functions/getODataRequestContext.md) for
the whole handler, including its asynchronous continuations.

It runs after guards, so anything a guard attaches to the request (an authenticated user)
is visible to the hooks that read the context.

## Implements

* `NestInterceptor`

## Constructors

### Constructor

> **new ODataRequestContextInterceptor**(): `ODataRequestContextInterceptor`

#### Returns

`ODataRequestContextInterceptor`

## Methods

### intercept()

> **intercept**(`context`, `next`): `Observable`<`unknown`>

Defined in: [context/odata-request-context.ts:54](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/context/odata-request-context.ts#L54)

Method to implement a custom interceptor.

#### Parameters

##### context

`ExecutionContext`

an `ExecutionContext` object providing methods to access the
route handler and class about to be invoked.

##### next

`CallHandler`

a reference to the `CallHandler`, which provides access to an
`Observable` representing the response stream from the route handler.

#### Returns

`Observable`<`unknown`>

#### Implementation of

`NestInterceptor.intercept`
