Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
fix/tighter-input-parsing-content-types (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlalmes authored Jan 3, 2023
1 parent d477cbd commit 9cea214
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const body = await res.json(); /* { greeting: 'Hello James!' } */
Peer dependencies:

- [`tRPC`](https://github.com/trpc/trpc) Server v10 (`@trpc/server`) must be installed.
- [`Zod`](https://github.com/colinhacks/zod) v3 (`zod@^3.14.4`) must be installed (recommended `^3.20.2`).
- [`Zod`](https://github.com/colinhacks/zod) v3 (`zod@^3.14.4`) must be installed (recommended `^3.20.0`).

For a procedure to support OpenAPI the following _must_ be true:

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"@types/lodash.clonedeep": "^4.5.7",
"@types/node": "^18.11.18",
"@types/node-fetch": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"aws-lambda": "^1.0.7",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
Expand Down
3 changes: 2 additions & 1 deletion src/adapters/node-http/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export const getBody = async (req: NodeHTTPRequest, maxBodySize = BODY_100_KB):

req.body = undefined;

if (req.headers['content-type']) {
const contentType = req.headers['content-type'];
if (contentType === 'application/json' || contentType === 'application/x-www-form-urlencoded') {
try {
const { raw, parsed } = await parse(req, {
limit: maxBodySize,
Expand Down

0 comments on commit 9cea214

Please sign in to comment.