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

347
Views
API not fetching any response even for status 200 in react(Fetch API)

I am integrating an API with my react login form, but I am getting Failed to load response data: No data found for a resource with given identifier even for the status code 200.

When I fired the API in postman everything was working fine but when I integrate it with my application it is showing error index.js:1 Error: SyntaxError: Unexpected end of input

let userLogIn = async function() {
        fetch('http://kishansharma.pythonanywhere.com/login', {
            method: 'POST', 
            mode: 'no-cors', 
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
            },
            body: `email=${emailId}&password=${password}`,
        })
        .then(response => response.json())
        .then((data) => {
        console.log('Success:', data);
        })
        .catch((error) => {
        console.error('Error:', error);
        });
    }

I have added the code where I am integrating the API, any help will be appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Error SyntaxError: Unexpected end of input usually comes from invalid json response. Maybe Postman shows you the raw response as text. You should check if the response is valid json with no syntax failurs.

Things to try:

  • In your headers object add the following: Accept': 'application/json'
  • Is the response realy valid JSON? Sometimes ther is a missing }
about 4 years ago · Juan Pablo Isaza Report
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!