mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Try telling Curl file size (#320)
This commit is contained in:
parent
041d333be7
commit
272949677b
@ -106,6 +106,7 @@ Curl.option = {
|
||||
SSL_VERIFYPEER: 'SSL_VERIFYPEER',
|
||||
TIMEOUT_MS: 'TIMEOUT_MS',
|
||||
UPLOAD: 'UPLOAD',
|
||||
INFILESIZE: 'INFILESIZE',
|
||||
URL: 'URL',
|
||||
USERAGENT: 'USERAGENT',
|
||||
USERNAME: 'USERNAME',
|
||||
|
@ -259,11 +259,11 @@ describe('actuallySend()', () => {
|
||||
FOLLOWLOCATION: true,
|
||||
HTTPHEADER: [
|
||||
'Content-Type: application/octet-stream',
|
||||
'Content-Length: 13',
|
||||
'Expect: ',
|
||||
'Transfer-Encoding: '
|
||||
],
|
||||
NOPROGRESS: false,
|
||||
INFILESIZE: 13,
|
||||
PROXY: '',
|
||||
NOBODY: 0,
|
||||
TIMEOUT_MS: 0,
|
||||
|
@ -323,8 +323,8 @@ export function _actuallySend (renderedRequest, workspace, settings) {
|
||||
setOpt(Curl.option.HTTPPOST, data);
|
||||
} else if (renderedRequest.body.fileName) {
|
||||
const {size} = fs.statSync(renderedRequest.body.fileName);
|
||||
headers.push({name: 'Content-Length', value: `${size}`});
|
||||
const fd = fs.openSync(renderedRequest.body.fileName, 'r+');
|
||||
setOpt(Curl.option.INFILESIZE, size);
|
||||
setOpt(Curl.option.UPLOAD, 1);
|
||||
setOpt(Curl.option.READDATA, fd);
|
||||
const fn = () => fs.closeSync(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user