天天看点

nodejs应用错误消息PayloadTooLarge的处理

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的处理

继续阅读