I am writing a server in node using async/await (http://stackabuse.com/node-js-async-await-in-es7/ and using bable to transpile) and request (https://github.com/request/request). I am trying to make a post request to an external api and access the http response headers. I can only figure out how to access the request that I am sending. How do I get the HttpResponse?
Here is the code
var options = {
url: externalUrl,
form: body
};
try {
var httpResponse = await request.post(options);
console.log(httpResponse.headers.location);
return "post request succeeded!";
} catch (err) {
return done(err, null);
}