feat(core): added misssing server events parameters
MODIFY
packages/core/src/server/server.event.subscriber.ts
packages/core/src/server/server.event.subscriber.ts
@@ -10,36 +10,36 @@ export const subscribeServerEvents =
(event$: Subject<AllServerEvents>) =>
(httpServer: http.Server | https.Server) => {
- httpServer.on(ServerEventType.CONNECT, () =>
- event$.next(ServerEvent.connect()),
+ httpServer.on(ServerEventType.CONNECT, (req: http.IncomingMessage, socket: net.Socket, head: Buffer) =>
+ event$.next(ServerEvent.connect(req, socket, head)),
);
- httpServer.on(ServerEventType.CONNECTION, () =>
- event$.next(ServerEvent.connection()),
+ httpServer.on(ServerEventType.CONNECTION, (socket: net.Socket) =>
+ event$.next(ServerEvent.connection(socket)),
);
- httpServer.on(ServerEventType.CLIENT_ERROR, () =>
- event$.next(ServerEvent.clientError()),
+ httpServer.on(ServerEventType.CLIENT_ERROR, (error: Error, socket: net.Socket) =>
+ event$.next(ServerEvent.clientError(error, socket)),
);
httpServer.on(ServerEventType.CLOSE, () =>
event$.next(ServerEvent.close()),
);
- httpServer.on(ServerEventType.CHECK_CONTINUE, () =>
- event$.next(ServerEvent.checkContinue()),
+ httpServer.on(ServerEventType.CHECK_CONTINUE, (req: http.IncomingMessage, res: http.ServerResponse) =>
+ event$.next(ServerEvent.checkContinue(req, res)),
);
- httpServer.on(ServerEventType.CHECK_EXPECTATION, () =>
- event$.next(ServerEvent.checkExpectation()),
+ httpServer.on(ServerEventType.CHECK_EXPECTATION, (req: http.IncomingMessage, res: http.ServerResponse) =>
+ event$.next(ServerEvent.checkExpectation(req, res)),
);
- httpServer.on(ServerEventType.ERROR, () =>
- event$.next(ServerEvent.error()),
+ httpServer.on(ServerEventType.ERROR, (error: Error) =>
+ event$.next(ServerEvent.error(error)),
);
- httpServer.on(ServerEventType.REQUEST, () =>
- event$.next(ServerEvent.request()),
+ httpServer.on(ServerEventType.REQUEST, (req: http.IncomingMessage, res: http.ServerResponse) =>
+ event$.next(ServerEvent.request(req, res)),
);
httpServer.on(ServerEventType.UPGRADE, (req: http.IncomingMessage, socket: net.Socket, head: Buffer) =>

MODIFY
packages/core/src/server/server.event.ts
packages/core/src/server/server.event.ts
@@ -17,21 +17,42 @@ export enum ServerEventType {
}
export const ServerEvent = {
- connect: createEvent(ServerEventType.CONNECT),
+ connect: createEvent(
+ ServerEventType.CONNECT,
+ (request: http.IncomingMessage, socket: net.Socket, head: Buffer) => ({ request, socket, head }),
+ ),
- connection: createEvent(ServerEventType.CONNECTION),
+ connection: createEvent(
+ ServerEventType.CONNECTION,
+ (socket: net.Socket) => ({ socket }),
+ ),
- clientError: createEvent(ServerEventType.CLIENT_ERROR),
+ clientError: createEvent(
+ ServerEventType.CLIENT_ERROR,
+ (error: Error, socket: net.Socket) => ({ error, socket }),
+ ),
close: createEvent(ServerEventType.CLOSE),
- checkContinue: createEvent(ServerEventType.CHECK_CONTINUE),
+ checkContinue: createEvent(
+ ServerEventType.CHECK_CONTINUE,
+ (request: http.IncomingMessage, response: http.ServerResponse) => ({ request, response }),
+ ),
- checkExpectation: createEvent(ServerEventType.CHECK_EXPECTATION),
+ checkExpectation: createEvent(
+ ServerEventType.CHECK_EXPECTATION,
+ (request: http.IncomingMessage, response: http.ServerResponse) => ({ request, response }),
+ ),
- error: createEvent(ServerEventType.ERROR),
+ error: createEvent(
+ ServerEventType.ERROR,
+ (error: Error) => ({ error }),
+ ),
- request: createEvent(ServerEventType.REQUEST),
+ request: createEvent(
+ ServerEventType.REQUEST,
+ (request: http.IncomingMessage, response: http.ServerResponse) => ({ request, response }),
+ ),
upgrade: createEvent(
ServerEventType.UPGRADE,

feat(core): added misssing server events parameters