mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-21 22:57:59 -04:00
Fix binary file upload method
This commit is contained in:
@@ -398,9 +398,14 @@ export function _actuallySend (
|
||||
const {size} = fs.statSync(renderedRequest.body.fileName);
|
||||
const fileName = renderedRequest.body.fileName || '';
|
||||
const fd = fs.openSync(fileName, 'r+');
|
||||
|
||||
setOpt(Curl.option.INFILESIZE, size);
|
||||
setOpt(Curl.option.UPLOAD, 1);
|
||||
setOpt(Curl.option.READDATA, fd);
|
||||
|
||||
// We need this, otherwise curl will send it as a POST
|
||||
setOpt(Curl.option.CUSTOMREQUEST, renderedRequest.method);
|
||||
|
||||
const fn = () => fs.closeSync(fd);
|
||||
curl.on('end', fn);
|
||||
curl.on('error', fn);
|
||||
|
||||
Reference in New Issue
Block a user