@@ -520,6 +520,7 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
520
520
headers : req . headers ,
521
521
id : randomBytes ( 16 ) . toString ( "hex" ) ,
522
522
ip,
523
+ query,
523
524
name : op . name ,
524
525
version : 3 ,
525
526
} ;
@@ -769,7 +770,7 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
769
770
return ;
770
771
}
771
772
772
- const request = this . parseRequest ( req , body . toString ( ) , clientIp ) ;
773
+ const request = this . parseRequest ( req , body . toString ( ) , clientIp , query ) ;
773
774
774
775
if ( ! request ) {
775
776
this . writeReply (
@@ -798,14 +799,14 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
798
799
writeReply ( ctx , await executeRequest ( ctx , this . apiConfig ) ) ;
799
800
}
800
801
801
- private parseRequest ( req : IncomingMessage , body : string , ip : string ) : ContextRequest | null {
802
+ private parseRequest ( req : IncomingMessage , body : string , ip : string , query : string | null ) : ContextRequest | null {
802
803
switch ( this . identifyRequestVersion ( req , body ) ) {
803
804
case 1 :
804
- return this . parseRequestV1 ( req , body , ip ) ;
805
+ return this . parseRequestV1 ( req , body , ip , query ) ;
805
806
case 2 :
806
- return this . parseRequestV2 ( req , body , ip ) ;
807
+ return this . parseRequestV2 ( req , body , ip , query ) ;
807
808
case 3 :
808
- return this . parseRequestV3 ( req , body , ip ) ;
809
+ return this . parseRequestV3 ( req , body , ip , query ) ;
809
810
default :
810
811
throw new Error ( "Failed to understand request" ) ;
811
812
}
@@ -826,7 +827,7 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
826
827
}
827
828
828
829
// Old Sdkgen format
829
- private parseRequestV1 ( req : IncomingMessage , body : string , ip : string ) : ContextRequest {
830
+ private parseRequestV1 ( req : IncomingMessage , body : string , ip : string , query : string | null ) : ContextRequest {
830
831
const parsed = decode (
831
832
{
832
833 Request : {
@@ -871,14 +872,15 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
871
872
files : [ ] ,
872
873
headers : req . headers ,
873
874
id : `${ deviceId } -${ parsed . id } ` ,
875
+ query,
874
876
ip,
875
877
name : parsed . name ,
876
878
version : 1 ,
877
879
} ;
878
880
}
879
881
880
882
// Maxima sdkgen format
881
- private parseRequestV2 ( req : IncomingMessage , body : string , ip : string ) : ContextRequest {
883
+ private parseRequestV2 ( req : IncomingMessage , body : string , ip : string , query : string | null ) : ContextRequest {
882
884
const parsed = decode (
883
885
{
884
886
Request : {
@@ -926,14 +928,15 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
926
928
files : [ ] ,
927
929
headers : req . headers ,
928
930
id : `${ parsed . deviceId } -${ parsed . requestId ?? randomBytes ( 16 ) . toString ( "hex" ) } ` ,
931
+ query,
929
932
ip,
930
933
name : parsed . name ,
931
934
version : 2 ,
932
935
} ;
933
936
}
934
937
935
938
// New sdkgen format
936
- private parseRequestV3 ( req : IncomingMessage , body : string , ip : string ) : ContextRequest {
939
+ private parseRequestV3 ( req : IncomingMessage , body : string , ip : string , query : string | null ) : ContextRequest {
937
940
const parsed = decode (
938
941
{
939
942
DeviceInfo : {
@@ -989,6 +992,7 @@ export class SdkgenHttpServer<ExtraContextT = unknown> {
989
992
headers : req . headers ,
990
993
id : `${ deviceId } -${ parsed . requestId ?? randomBytes ( 16 ) . toString ( "hex" ) } ` ,
991
994
ip,
995
+ query,
992
996
name : parsed . name ,
993
997
version : 3 ,
994
998
} ;
0 commit comments