I am getting the error { [Error: unknown transfer-encoding] status: 400 } from the express 3 module multipart. It sounds like the TE header should be getting sent - which it isn't. However, I have read that this header is incompatible with the content-length header, which is getting sent.
The following headers are getting sent:
{
connection: 'keep-alive',
'content-type': 'multipart/form-data; boundary=--------092114122750368',
'content-length': '6983',
host: '******* ',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'accept-encoding': 'identity',
'user-agent': 'Mozilla/3.0 (compatible; Indy Library)'
}
Any thoughts on what might be causing this issue?
edit1
server code is given below:
var port = 80,
express = require('express'),
app;
app = express();
// support JSON, urlencoded, and multipart requests
app.use(express.json({
limit: '50mb'
}));
app.use(express.urlencoded({
limit: '50mb'
}));
app.use(express.multipart({
uploadDir:'./uploads',
limit: '50mb'
}));
app.use(function (err, req, res, next) {
console.log(req.headers);
console.log(err);
});
There is obviously more code, but this is where the error actually occurs. The output of req.header is what I supplied above as JSON and the output of { [Error: unknown transfer-encoding] status: 400 } was in the first line of this post. I originally added error callbacks after each app.use call but I found that it was express.multipart that was causing the issue.
We had to add in transfer-encoding: chunked as this was how the data was being sent. The HTTP library we were using was adding in the content-length property, which is incompatible with the transfer-encoding property but it did not cause an issue with the server, so this is what we settled with.