diff --git a/src/superagent.js b/src/superagent.js index 1f66ea11a..446077902 100644 --- a/src/superagent.js +++ b/src/superagent.js @@ -144,7 +144,7 @@ class Request { if (!(this.fetchOptions.body instanceof FormData)) this.fetchOptions.body = new FormData(); const data = fs.readFileSync(filepath, 'utf8'); this.fetchOptions.body.append(name, new Blob([data]), path.basename(filepath)); - this.fetchOptions.headers.set('Content-Type', 'multipart/form-data'); + this.fetchOptions.headers.delete('Content-Type'); // explicitly remove it. without it boundary won't make it to the header! return this; } diff --git a/src/test/superagent-test.js b/src/test/superagent-test.js index ac79ce5be..6d08876ff 100644 --- a/src/test/superagent-test.js +++ b/src/test/superagent-test.js @@ -1,6 +1,5 @@ /* global it:false */ /* global describe:false */ -/* global before:false */ 'use strict'; @@ -22,4 +21,8 @@ describe('Superagent', function () { const [error] = await safe(superagent.get('https://cloudron.io').set('User-Agent', 'Mozilla').timeout(10*1000).redirects(0)); expect(error).to.be.ok(); }); + + it('can disable certs', async function () { + await superagent.get('https://www.cloudron.io').set('User-Agent', 'Mozilla').disableTLSCerts(); + }); });