question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

401 response code is shown as 200

See original GitHub issue
var nodeFetch = require("node-fetch")
nodeFetch('https://bitbucket.org/atlassian/foo/get/master.zip').then((res) => {
  console.log(res.status);
});

This URL returns 401 but for some reason, I get back 200.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
bitinncommented, Sep 8, 2019

I will be closing this as it seems like a misunderstanding of server behavior.

0reactions
norcal82commented, Aug 18, 2019

@1999 that zip url requires authentication. So when you try to access it without any auth info it will redirect you to a login page. The login page is returning the successful 200. Curl wont follow redirects with just the curl command. The -L flag should make curl follow the redirect and return a 200. 3xx codes indicate a redirection. fetch defaults to follow the redirects which is why without that param it is returning a 200.

Read more comments on GitHub >

github_iconTop Results From Across the Web

401 Unauthorized - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed ...
Read more >
How to Quickly Fix the 401 Unauthorized Error (5 Methods)
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the ...
Read more >
HttpGet 401 status code followed by 200 status code
v(this, "Response code status: " + status); // code status = 200 (even if a 401 and then a 200 are visible in...
Read more >
401 Unauthorized Error: What It Is and How to Fix It
The 401 Unauthorized Error is an HTTP response status code indicating that the client could not authenticate a request.
Read more >
HTTP/1.1: Status Code Definitions
This class of status code indicates that the client's request was successfully received, understood, and accepted. 10.2.1 200 OK. The request has succeeded....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found