Composer rest server entity too large

♀尐吖头ヾ 提交于 2019-12-11 15:45:11

问题


I'm storing images in fabric blockchain as base64 strings. Here, whenever I try to interact(update or add assets including base64 strings) with the blockchain through the composer rest server, it throws below error,

Error: request entity too large

How to increase the request size limit or what are other possible approaches to handle this issue?


回答1:


I was able to edit the maximum request size of the REST server by editing the server.js located in path_to_rest_server/server/. I edited below code,

// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json());

// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
    extended: true,
}));

to,

// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json({
  strict: false,
  limit: "10000kb"
}));

// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
  extended: true,
  limit: "10000kb"
}));

10000kb is the size limit.



来源:https://stackoverflow.com/questions/52238352/composer-rest-server-entity-too-large

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!