请求是发送一个包含大文件的表单,
用postman可以测试通过
但是在node中用curl发送请求的时候会返回
413:Request entity too large
的错误
网上的方法都是说服务器端配置问题,比如nginx的body大小配置,但是我用postman可以发送大文件页返回了结果,那么说明服务端没有问题的
客户端用的是阿里的egg框架
我尝试了修改bodyParser的限制:
config.bodyParser = {
formLimit:'4096mb',
jsonLimit:'4096mb',
textLimit:'4096mb'
}
还是不行
完整的请求:
{
method: 'POST',
dataType: 'text',
headers: {
'Content-Type': 'multipart/form-data; boundary=--------------------------882977121791509506264077',
Accept: '*/*',
'Cache-Control': 'no-cache',
'Accept-Encoding': 'gzip, deflate, br',
Connection: 'keep-alive',
'Content-Length': 552792032
},
stream: FormStream {
_events: [Object: null prototype] { destroy: [Function] },
_eventsCount: 1,
_maxListeners: undefined,
_boundary: '--------------------------882977121791509506264077',
_streams: [ [Array] ],
_buffers: [],
_endData: <Buffer 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 38
38 32 39 37 37 31 32 31 37 39 31 35 30 39 35 30 36 32 36 34 30 ... 6 more bytes>,
_contentLength: 56,
_isAllStreamSizeKnown: false,
_knownStreamSize: 0
},
auth: 'admin:hik12345',
timeout: 3600000
} {
field: 'uploadedFile',
filename: 'dc_dfr_v3.2.x_p4_l64_baseline_build191021_ad1a1104b96ff2ace8e2ccb3a32d6401.zip',
encoding: '7bit',
mime: 'application/zip',
fieldname: 'uploadedFile',
transferEncoding: '7bit',
mimeType: 'application/zip',
filepath: 'C:\\Users\\laiyinan\\AppData\\Local\\Temp\\egg-multipart-tmp\\mwm-web\\2020\\02\\22\\15\\8fff1806-57ef-410a-afb3-bbcdb6955277.zip'
}