You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rpc: RPC over HTTP silently drops Infinity from results #780
Over RpcHttpClientAdapter, a non-finite number in a result is lost and the call still succeeds: a number property disappears and a number result becomes undefined. Over WebSocket the same calls return Infinity.
import{App}from'@deepkit/app';import{ApplicationServer,FrameworkModule}from'@deepkit/framework';import{rpc,RpcClient,RpcHttpClientAdapter}from'@deepkit/rpc';interfaceRange{min: number;max: number;}
@rpc.controller('range')classRangeController{
@rpc.action()unbounded(): Range{return{min: 0,max: Infinity};}
@rpc.action()limit(): number{return-Infinity;}}constapp=newApp({controllers: [RangeController],imports: [newFrameworkModule({port: 8080,httpRpcBasePath: '/api'})]});awaitapp.get(ApplicationServer).start();constrange=newRpcClient(newRpcHttpClientAdapter('http://127.0.0.1:8080/api')).controller<RangeController>('range');console.log(awaitrange.unbounded().catch((error: Error)=>error.message));// actual: { min: 0 }, should be: { min: 0, max: Infinity } or an errorconsole.log(awaitrange.limit().catch((error: Error)=>error.message));// actual: undefined, should be: -Infinity or an error
Activity