I'm trying to retrieve the server response header for a request from a server.
import 'request' from 'request'
var url = "SOME_URL"
var options = { url: url };
var callback = function(error, response, body) {
if(!error){
console.log(response); // <==
}
}
request(options, callback)
Going through the "response" object it doesn't look like it contains the Server response-header .htm
The only header being returned after doing this
console.log(response.headers)
is from the client request header.
Can anyone point in towards the right direction in order to access this object.
I'm trying to retrieve the server response header for a request from a server.
import 'request' from 'request'
var url = "SOME_URL"
var options = { url: url };
var callback = function(error, response, body) {
if(!error){
console.log(response); // <==
}
}
request(options, callback)
Going through the "response" object it doesn't look like it contains the Server response-header http://www.tutorialspoint./http/http_header_fields.htm
The only header being returned after doing this
console.log(response.headers)
is from the client request header.
Can anyone point in towards the right direction in order to access this object.
Share Improve this question edited Aug 25, 2016 at 16:24 philip_nunoo asked Aug 25, 2016 at 12:20 philip_nunoophilip_nunoo 9384 gold badges10 silver badges22 bronze badges 1- I am facing the same problem. Were you able to find a solution to this ? – Pratik Singhal Commented Nov 10, 2017 at 14:19
1 Answer
Reset to default 7use
response.headers
instead of
response.header