Closed snydergd closed 2 years ago
@snydergd Thanks for reporting! We are working on more prioritized issues now but will get back to this one soon.
This issue has had no activity in 90 days. Please comment if it is not actually stale
@vmapetr thanks for following up! I just realized I did not provide much context on this and that it might be useful. I discovered the issue while using azure-devops-node-api in a nodejs task extension for Azure DevOps. Since that runs behind the scenes on a server, this means I was left guessing the error message or trying to recreating the request from that library locally to see what the error was.
Environment
Node version: 10 Npm version: 6.14.2 OS and version: Ubuntu 20.04.4 typed-rest-client version: 1.8.9
Issue Description
The API I am calling returns a 400 (bad request) response and an error is thrown by the client. I log the error to determine what happened, but all I have available to me is the result (if available) and the status code. There is an error message in one of the HTTP headers of the response, but I do not have access to that. Without being able to log these other details, it is difficult to debug what the problem is with the request.
Expected behaviour
I would like to suggest that the full response, or at least the response headers, be provided in the error object when these error responses are received.
Actual behaviour
I'm unable to see the error message from a response if it is inside a response header.
Steps to reproduce
See where the error object is being created/thrown, and you can reproduce by running the below script with nodejs:
There seems to be no way to retrieve the value
The header you provided is not recognized
from the resulting error.Logs
The output of above looks like the following