I have an API that returns content with content-type: "multipart/form-data; charset=utf-8"
. However, in my nodejs app, when I make the following call through superagent
:
request
.get(ApiUrl + id)
.set('Authorization', basicHttpAuth)
.set('client_id', clientId)
.set('client_secret', clientSecret)
.end(function (err, res) {
if (err) {
callback(null, err)
console.log(err);
}
else {
callback(null, res);
}
})
I get this error:
Error: bad content-type header, no multipart boundary
Any idea what's wrong?
Stack Trace:
Error: bad content-type header, no multipart boundary
at IncomingForm._parseContentType (/Users/mike/Svr/Server/node_modules/formidable/lib/incoming_form.js:271:19)
at IncomingForm.writeHeaders (/Users/mike/Svr/Server/node_modules/formidable/lib/incoming_form.js:142:8)
at IncomingForm.parse (/Users/mike/Svr/Server/node_modules/formidable/lib/incoming_form.js:110:8)
at ClientRequest.<anonymous> (/Users/mike/Svr/Server/node_modules/superagent/lib/node/index.js:869:9)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:564:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
at TLSSocket.socketOnData (_http_client.js:453:20) response: undefined }
Here is the server response header:
Access-Control-Allow-Origin →*
Connection →keep-alive
Content-Length →44691
Content-Type →multipart/form-data; charset=utf-8
Date →Wed, 05 Jul 2017 03:44:23 GMT
And the body is big blob of text / string.