Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Why any http response with status code different of 200 axios gets response undefined

So I'm developing a c# API that returns some status codes, and this is my function on controller:

public IHttpActionResult validateToken(HttpRequestMessage request, string token)
{
        bool result = AuthUser.validateToken(token);

        if (!result)
        {
            return BadRequest();
        }
        else
        {
            return Ok();
        }
}

Then I have my axios to make the requests:

    this.$axios.get("validateResetToken/" + token)
      .then((response) => {
        console.log(response)
      })
      .catch((error) => console.log(error));

And when the API returns the 200, Ok(), the response gives me a object:

enter image description here

But when the return is anything than Ok [ 200 ], the response is always undifined and I cant figure it out why.

enter image description here

Why cant I have always a response, to get the status code, in this case 200 or 400.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!