4 ms·
This is not the case with the great library superagent[0], which I can confirm with a little test case I wrote. I have a server that returns a 401 when the Aut
by adregan 12y ago
This is not the case with the great library superagent[0], which I can confirm with a little test case I wrote.
I have a server that returns a 401 when the Authorization header is missing, but I also like to return a JSON body with a little more information as to what went wrong (ie. the header is flat out missing or the credentials aren't being sent in the correct way, with a link to the documentation), and superagent allows you to output the `response.body` in the `end()` method callback.
I think of superagent as the requests[1] of js. In fact, I usually require it under the name requests as they feel so similar.
0: https://github.com/visionmedia/superagent https://github.com/visionmedia/superagent
1: http://docs.python-requests.org/en/latest/ http://docs.python-requests.org/en/latest/
EDIT: link formatting