@@ -15,7 +15,7 @@ import {Codecs} from '../../../json-pack/codecs/Codecs';
1515import { RpcMessageCodecs } from '../../common/codec/RpcMessageCodecs' ;
1616import { NullObject } from '../../../util/NullObject' ;
1717
18- export type Http1Handler = ( ctx : Http1ConnectionContext ) => void ;
18+ export type Http1Handler = ( ctx : Http1ConnectionContext ) => void | Promise < void > ;
1919export type Http1NotFoundHandler = ( res : http . ServerResponse , req : http . IncomingMessage ) => void ;
2020export type Http1InternalErrorHandler = ( error : unknown , res : http . ServerResponse , req : http . IncomingMessage ) => void ;
2121
@@ -115,7 +115,7 @@ export class Http1Server implements Printable {
115115 this . httpRouter . add ( route , match ) ;
116116 }
117117
118- private readonly onRequest = ( req : http . IncomingMessage , res : http . ServerResponse ) => {
118+ private readonly onRequest = async ( req : http . IncomingMessage , res : http . ServerResponse ) => {
119119 try {
120120 res . sendDate = false ;
121121 const url = req . url ?? '' ;
@@ -135,9 +135,9 @@ export class Http1Server implements Printable {
135135 const codecs = this . codecs ;
136136 const ip = this . findIp ( req ) ;
137137 const token = this . findToken ( req ) ;
138- const ctx = new Http1ConnectionContext ( req , res , path , query , ip , token , match . params , new NullObject ( ) , codecs . value . json , codecs . value . json , codecs . messages . jsonRpc2 ) ;
138+ const ctx = new Http1ConnectionContext ( req , res , path , query , ip , token , match . params , new NullObject ( ) , codecs . value . json , codecs . value . json , codecs . messages . compact ) ;
139139 const handler = match . data . handler ;
140- handler ( ctx ) ;
140+ await handler ( ctx ) ;
141141 } catch ( error ) {
142142 this . oninternalerror ( error , res , req ) ;
143143 }
0 commit comments