File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export interface RpcAppOptions {
3737 * Serializers and de-serializers for request and response bodies.
3838 */
3939 codecs ?: Codecs ;
40-
40+
4141 /**
4242 * HTTP port to listen on. If not specified, the PORT environment variable
4343 * will be used, or 9999 if not set.
@@ -72,8 +72,8 @@ export class RpcApp<Ctx extends ConnectionContext> {
7272
7373 constructor ( protected readonly options : RpcAppOptions ) {
7474 this . app = options . uws ;
75- this . maxRequestBodySize = options . maxRequestBodySize ?? 1024 * 1024 ,
76- this . codecs = new RpcCodecs ( options . codecs ?? new Codecs ( new Writer ( ) ) , new RpcMessageCodecs ( ) ) ;
75+ ( this . maxRequestBodySize = options . maxRequestBodySize ?? 1024 * 1024 ) ,
76+ ( this . codecs = new RpcCodecs ( options . codecs ?? new Codecs ( new Writer ( ) ) , new RpcMessageCodecs ( ) ) ) ;
7777 this . batchProcessor = new RpcMessageBatchProcessor < Ctx > ( { caller : options . caller } ) ;
7878 }
7979
@@ -256,7 +256,7 @@ export class RpcApp<Ctx extends ConnectionContext> {
256256 this . startRouting ( ) ;
257257 const options = this . options ;
258258 const port = options . port ?? + ( process . env . PORT || 9999 ) ;
259- const host = options . host ?? ( process . env . HOST ?? '0.0.0.0' ) ;
259+ const host = options . host ?? process . env . HOST ?? '0.0.0.0' ;
260260 const logger = options . logger ?? console ;
261261 this . options . uws . listen ( host , port , ( token ) => {
262262 if ( token ) {
Original file line number Diff line number Diff line change @@ -6,17 +6,14 @@ describe('pubsub', () => {
66 test ( 'throws error on invalid input' , async ( ) => {
77 const { call} = setup ( ) ;
88 try {
9- await call (
10- 'pubsub.publish' ,
11- {
12- channel2 : 'INVALID KEY' ,
13- message : 'hello world' ,
14- } as any ,
15- ) ;
16- throw new Error ( 'should not reach here' ) ;
17- } catch ( err : any ) {
18- expect ( err . meta . path ) . toStrictEqual ( [ 'channel2' ] ) ;
19- }
9+ await call ( 'pubsub.publish' , {
10+ channel2 : 'INVALID KEY' ,
11+ message : 'hello world' ,
12+ } as any ) ;
13+ throw new Error ( 'should not reach here' ) ;
14+ } catch ( err : any ) {
15+ expect ( err . meta . path ) . toStrictEqual ( [ 'channel2' ] ) ;
16+ }
2017 } ) ;
2118
2219 test ( 'can subscribe and receive published messages' , async ( ) => {
Original file line number Diff line number Diff line change 11// Run: npx ts-node src/server/index.ts
22
33import { App } from 'uWebSockets.js' ;
4- import { RpcApp } from '../reactive-rpc/server/uws/RpcApp' ; ;
4+ import { RpcApp } from '../reactive-rpc/server/uws/RpcApp' ;
55import { createCaller } from './routes' ;
66import { Services } from './services/Services' ;
77import type { MyCtx } from './services/types' ;
You can’t perform that action at this time.
0 commit comments