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

111
Views
fetch empty body when using opera

I am trying to call my restapi (created with java spring) to authorize the user in vuejs. To do that I call an HTTP request using fetch. This works fine in chrome and firefox, however not in Opera andEdge.

This is the code I am executing in the mounted() method:

      fetch(
          'http://localhost:8083/oauth2/user',
          {
            method: 'GET',
            headers: {
              'Authorization': localStorage.accesstoken,
              'Accept': 'application/json',
              'Content-Type': 'application/json',
            },
          }
      )
          .then(res => {
                console.log("Status: " + res.status)
                if (res.status === 200) {
                  return res.json();
                } else {
                  console.log(res.text())
                }
              }
          )
          .then(res => {
                console.log("jsondata: " + res)
              }
          )
          .catch((e) => {
                console.log(e)
              }
          )

Running in Opera:

Status: 200

SyntaxError: Unexpected end of JSON input

Response: "This request has no response data available."

Running in Chrome

Status: 200
jsondata: [object Object]

Response: <correct JSON object it's suppose to have>

This is the java spring boot I call:

    @CrossOrigin
    @GetMapping("/oauth2/user")
    ResponseEntity<String> getUserInfo(@RequestHeader("Authorization") String authentication){
        try {
            PrimeUser user = authenticateUser(authentication);
            assert user != null;
            return ResponseEntity.ok()
                    .body(new Gson().toJson(user));
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseEntity.internalServerError()
                    .body(e.getMessage());
        }
    }

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!