Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get HTTP status code #172

Open
fvisticot opened this issue Nov 5, 2017 · 2 comments
Open

How to get HTTP status code #172

fvisticot opened this issue Nov 5, 2017 · 2 comments

Comments

@fvisticot
Copy link

I need to get the status code in the answer. How can I retrieve this value ? (200 OK, 401...)

@alejandrotamayo
Copy link

Hi I was able to doit with response.statusCode. It gives me the code of response object.

`var req = client.post("http://XXXXXXXXXXX", args, function (data, response) {
console.log(data);
// raw response
console.log(typeof response);
console.log(response.statusCode);
/*
for(var propertyName in response) {
// you can get the value like this: myObject[propertyName]
console.log(propertyName);
}
*/

    });`

@inthegarage
Copy link

inthegarage commented Jun 15, 2021

@fvisticot This is the correct answer, so you should close the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants