@nestjs/common/interfaces#ExecutionContext TypeScript Examples
The following examples show how to use
@nestjs/common/interfaces#ExecutionContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: decorator.spec.ts From nestjs-paginate with MIT License | 6 votes |
function expressContextFactory(query: ExpressRequest['query']): Partial<ExecutionContext> {
const mockContext: Partial<ExecutionContext> = {
switchToHttp: (): HttpArgumentsHost =>
Object({
getRequest: (): Partial<ExpressRequest> =>
Object({
protocol: 'http',
get: () => 'localhost',
originalUrl: '/items?search=2423',
query: query,
}),
}),
}
return mockContext
}
Example #2
Source File: decorator.spec.ts From nestjs-paginate with MIT License | 6 votes |
function fastifyContextFactory(query: FastifyRequest['query']): Partial<ExecutionContext> {
const mockContext: Partial<ExecutionContext> = {
switchToHttp: (): HttpArgumentsHost =>
Object({
getRequest: (): Partial<FastifyRequest> =>
Object({
protocol: 'http',
hostname: 'localhost',
url: '/items?search=2423',
query: query,
}),
}),
}
return mockContext
}