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 puts long string arguments in the URL, which fails #768
The HTTP client sends an action whose arguments are all primitives as GET, with the arguments in the URL, whatever their length. A 20,000-character string already fails; the same text inside an object (sent as POST) works. Over WebSocket all three calls work.
import{App}from'@deepkit/app';import{ApplicationServer,FrameworkModule}from'@deepkit/framework';import{rpc,RpcClient,RpcHttpClientAdapter}from'@deepkit/rpc';
@rpc.controller('docs')classDocController{
@rpc.action()save(markdown: string): number{returnmarkdown.length;}
@rpc.action()saveNote(note: {markdown: string}): number{returnnote.markdown.length;}}constapp=newApp({controllers: [DocController],imports: [newFrameworkModule({port: 8080,httpRpcBasePath: '/api'})],});awaitapp.get(ApplicationServer).start();constdocs=newRpcClient(newRpcHttpClientAdapter('http://127.0.0.1:8080/api')).controller<DocController>('docs');console.log(awaitdocs.save('x'.repeat(20_000)).catch((error: Error)=>error.message));// actual: Unexpected end of JSON input, should be: 20000console.log(awaitdocs.save('x'.repeat(100_000)).catch((error: Error)=>error.message));// actual: fetch failed, should be: 100000console.log(awaitdocs.saveNote({markdown: 'x'.repeat(100_000)}));// 100000
Activity