I am using express as middle-ware api.A person hits my middle-ware , it hits some third party api and returns back the result. Its working fine for all other end points expect an get end point that creates an png and serves it. so under method returns response
_execute = R.curry((reqFunction, req, res) => {
reqFunction(req, res).
then(r => {
res.status(r.status).header(r.headers).send(r.data)
}).
catch(err => {
res.status(err.response.status).header(err.headers).send(err.response.data)
})
});
and reqFunction
is method like
modelDiagram = (req, res) => {
const headers = req.headers;
const modelName = req.params['modelName'];
const endPoint = this.modelDiagramEndPoint + '/' + modelName;
return this.httpRequests.get(endPoint, headers);
}
and httpRequests.get
method is
get = (endPoint, headers) => {
let options = {
method: 'GET',
url: endPoint
}
options = this.addHeaders(headers, options);
return this._send(options);
}
and this._send is like
_send = (options) => {
return axios(options);
};
the response if I directly hit from browser is like ``` �PNG
IHDRn��7Q� IDATx���oHk����D�ȥ|!H�DD�^)"k"n�̤$H�V뒻�Vж"�+��n-"�[��X