How to add header when piping JPEG image content from axios.get() response

Viewed 340

I am using building a node express HTTP web service that calls a web service that returns a JPEG file. The web service works to proxy the JPEG file but I need to add some content headers to the returned GET request that I respond via pipe. Any suggestions?

app.get('/rendition', function (req, res){

    let uri = `https://example.com/thumbnail2x`;

    axios.get(uri).then(function(response){
        // how do I add a header here?
        response.data.pipe(res);
    });
})
0 Answers
Related