You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/src/http/kernel/module/ClearRequestEventBusHTTPMod...

29 lines
811 B

import {HTTPKernelModule} from '../HTTPKernelModule'
import {Inject, Injectable} from '../../../di'
import {HTTPKernel} from '../HTTPKernel'
import {Request} from '../../lifecycle/Request'
import {Bus} from '../../../support/bus'
/**
* HTTP kernel module that creates a request-specific event bus
* and injects it into the request container.
*/
@Injectable()
export class ClearRequestEventBusHTTPModule extends HTTPKernelModule {
@Inject()
protected bus!: Bus
public static register(kernel: HTTPKernel): void {
kernel.register(this).first()
}
public async apply(request: Request): Promise<Request> {
const requestBus = request.make<Bus>(Bus)
await requestBus.down()
// FIXME disconnect request bus from global event bus
return request
}
}