Using body-parser v.1.19.0 in my service. There is a service that calls into my express server that has Content-Encoding: UTF-8
in the incoming header. Their service deals with other apps also, so not sure a quick solution would be fixed on their end. But in my server this causes error unsupported content encoding "utf-8"
.
Is there any solution in dealing with this incoming header from a body-parser standpoint? I have seen some solutions but they seem like bandaids.
One solution is to catch it in a middleware before it gets to body-parser and delete
it. But it seems this might be a performance concern using delete
app.use((req, res, next) => {
delete req.headers['content-encoding'];
next();
});
Or just redefine it to empty string also works so as to not use the delete
command
req.headers['content-encoding'] = '';
These seem like bandaids instead of addressing the incoming header and dealing with it. Is there some accepted solution when dealing with Content-Encoding
in an express service with body-parser?