diff --git a/lex-gen/deno.json b/lex-gen/deno.json index 1df78a0..cb52b6a 100644 --- a/lex-gen/deno.json +++ b/lex-gen/deno.json @@ -1,6 +1,6 @@ { "name": "@atp/lex-gen", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "exports": "./mod.ts", "license": "MIT", "imports": { diff --git a/xrpc-server/deno.json b/xrpc-server/deno.json index 3e1ff18..febfb72 100644 --- a/xrpc-server/deno.json +++ b/xrpc-server/deno.json @@ -1,6 +1,6 @@ { "name": "@atp/xrpc-server", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "exports": "./mod.ts", "license": "MIT", "imports": { diff --git a/xrpc-server/util.ts b/xrpc-server/util.ts index 4bca4db..fce3266 100644 --- a/xrpc-server/util.ts +++ b/xrpc-server/util.ts @@ -248,13 +248,18 @@ function createBodyParser( } const text = await req.text(); return JSON.parse(text); - } else { + } else if ( + encoding.startsWith("text/") || + encoding === "application/x-www-form-urlencoded" + ) { if (textLimit && bodySize > textLimit) { throw new InvalidRequestError( `Request body too large: ${bodySize} bytes exceeds text limit of ${textLimit} bytes`, ); } return await req.text(); + } else { + return; } }; } @@ -271,7 +276,7 @@ function decodeBodyStream( } if (!contentEncoding) { - return req.body.pipeThrough(new TextDecoderStream()); + return req.body; } if (!contentLength) {