且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

nodejs应用错误消息PayloadTooLarge的处理

更新时间:2022-08-21 14:57:18

nodejs应用错误消息PayloadTooLarge的处理

根据出错信息显示的node_modules\raw-body\index.js,进入代码:nodejs应用错误消息PayloadTooLarge的处理

nodejs应用错误消息PayloadTooLarge的处理

nodejs应用错误消息PayloadTooLarge的处理

function readStream (stream, encoding, length, limit, callback) {
  var complete = false
  var sync = true

  // check the length and limit options.
  // note: we intentionally leave the stream paused,
  // so users should handle the stream themselves.
  if (limit !== null && length !== null && length > limit) {
    return done(createError(413, 'request entity too large', {
      expected: length,
      length: length,
      limit: limit,
      type: 'entity.too.large'
    }))
  }

nodejs应用错误消息PayloadTooLarge的处理