Home Ask Login Register

Developers Planet

Your answer is one click away!

Jared Ostyn February 2016

Aurelia: fetch-client response doesn't have my data

I've been banging my head against fetch-client for too long and I need some help.

I'm getting some data from Skyscanner. The request hits their API and Chrome's dev tools list it in the network tab as a complete fetch request with code 200 and the correct response body.

import {inject} from 'aurelia-framework';
import {HttpClient} from 'aurelia-fetch-client';
export class Flights {
        http.configure(config => {
                mode: 'no-cors',
                headers: {
                    'Accept': 'application/json',
                    'Content-type' : 'application/json'

        this.data = "";
        this.http = http;
  activate() {
            .then(response => {
            .catch(ex => {

But when the response object is printed it has NOTHING in it:

Response {}
  body: null
  bodyUsed: false
  headers: Headers
  __proto__: Headers
  ok: false
  status: 0
  statusText: ""
  type: "opaque"
  url: ""
  __proto__: Response

All of the remaining console.log's produce undefined

Am I using fetch-client incorrectly? What am I missing?


Salva February 2016

Notice you're receiving an opaque response (type: "opaque"). Opaque responses does not allow you to read them. This is due to the no-cors mode you set before. You should use the cors mode and SkyScanner should provide the proper headers for your API key which is something I think they don't do.

Post Status

Asked in February 2016
Viewed 1,258 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life