ldabiralai/simulado

Error when trying to pass large JSON payload

Closed this issue · 1 comments

bdo commented

When trying to use #defaults or other simulado APIs with large payloads, the server fails to parse the body properly and throws a Request entity too largeerror, e.g:

Simulado is running at http://localhost:7001
Error
    at readStream (/Users/bdoncieu/projects/front_react/node_modules/raw-body/index.js:196:17)
    at getRawBody (/Users/bdoncieu/projects/front_react/node_modules/raw-body/index.js:106:12)
    at read (/Users/bdoncieu/projects/front_react/node_modules/body-parser/lib/read.js:76:3)
    at jsonParser (/Users/bdoncieu/projects/front_react/node_modules/body-parser/lib/types/json.js:127:5)
    at Layer.handle [as handle_request] (/Users/bdoncieu/projects/front_react/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/bdoncieu/projects/front_react/node_modules/express/lib/router/index.js:312:13)
    at /Users/bdoncieu/projects/front_react/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Users/bdoncieu/projects/front_react/node_modules/express/lib/router/index.js:330:12)
    at next (/Users/bdoncieu/projects/front_react/node_modules/express/lib/router/index.js:271:10)
    at cors (/Users/bdoncieu/projects/front_react/node_modules/cors/lib/index.js:179:7)
bdo commented

This is due to the default body-parser limit being 100kb. I suggest changing the default to 1mb.