我需要从客户端到服务器的数据块请求,但请求标头中不包含“ Transfer-Encoding:chunked”。
启用如下所示的块请求:
dropzoneOptions: {
url: process.env.BASE_URL + '/upload',
thumbnailWidth: 200,
addRemoveLinks: true,
uploadMultiple: false,
chunking: true,
chunkSize: 10000,
forceChunking: false,
maxFiles: 1000,
withCredentials: true,
在如下所示的API中:
fmt.Printf("Header: %v\n", c.Request.Header)
-> Header: map[Accept:[application/json] Accept-Encoding:[gzip, deflate, br] Accept-Language:[ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7] Cache-Control:[no-cache] Content-Length:[11071] Content-Type:[multipart/form-data; boundary=----WebKitFormBoundaryR3nyT2hp5fP3wETc] Cookie:[_ga=GA1.1.739076998.1535606573; _gid=GA1.1.2036091497.1553667440; _gat=1] Origin:[http://localhost:8080] Referer:[http://localhost:8080/] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36] X-Forwarded-For:[::1] X-Requested-With:[XMLHttpRequest]]
fmt.Printf("TE: %v\n", c.Request.TransferEncoding)
-> TE: []
通过卷曲:
$ curl -X POST -T "hoge.txt" -H 'Content-type: text/plain' --header "Transfer-Encoding: chunked" --header "Connection: Keep-Alive" http://localhost:3000/upload
server
-> TE: [chunked]
我希望请求标头中包含“ Transfer-Encoding:chunked”,而无需“ Content-Length”。
dropzone.js的“块”是什么意思?