天天看點

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

繼續閱讀