From 3c1e1b29803b28cfb68009633daff2d16fe5dc5b Mon Sep 17 00:00:00 2001 From: alaoui abdellah Date: Mon, 19 Dec 2016 11:02:16 +0000 Subject: [PATCH] Increase the limit of the request body The default limit of a request's body is `100kb`, which is not enough if you want to save something big (an image for example) in the database. Here is the link to the `limit` option in the docs: https://github.com/expressjs/body-parser#limit --- .../http/createPostGraphQLHttpRequestHandler.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/postgraphql/http/createPostGraphQLHttpRequestHandler.js b/src/postgraphql/http/createPostGraphQLHttpRequestHandler.js index d214953e8e..77f14a0975 100644 --- a/src/postgraphql/http/createPostGraphQLHttpRequestHandler.js +++ b/src/postgraphql/http/createPostGraphQLHttpRequestHandler.js @@ -70,9 +70,14 @@ export default function createPostGraphQLHttpRequestHandler (options) { // want that. const bodyParserMiddlewares = [ // Parse JSON bodies. - bodyParser.json(), + + // Limit: Controls the maximum request body size. If this is a number, + // then the value specifies the number of bytes; if it is a string, + // the value is passed to the bytes library for parsing. + // Defaults to '100kb' + bodyParser.json({ limit: '50mb' }), // Parse URL encoded bodies (forms). - bodyParser.urlencoded({ extended: false }), + bodyParser.urlencoded({ extended: false, limit: '50mb' }), // Parse `application/graphql` content type bodies as text. bodyParser.text({ type: 'application/graphql' }), ]