Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4836

Why are my headers always giving an “Adapter operation failed” error?

$
0
0

@brou wrote:

Aloha! Today, I'm trying to add custom headers to each request to my backend.

Playing with my DS.RESTAdapter, I already tried:

  • The 3 headers: solutions suggested in the official guide.

  • The 2 ajax: approaches proposed around there.

  • And 2 jQuery workarounds (based on $.ajaxPrefilter and $.ajaxSetup) that I found there.

Until now, my only result was this very obscure "Adapter operation failed" error:

{
  details: "",
  status: 0,
  title: "The backend responded with an error"
}

I know that:

  • My backend behaves well and returns a 200 status (I tested sending the request via cURL).
  • Strangely, removing my adapter's host setting allows the request to be sent, but obviously at the wrong URL.
  • My problem is not a CSP issue as I'm currently running both backend & frontend locally.

According to my debugging and to my Network Inspector tab, the AJAX request is just never sent (XHR.readyStatus is stuck at 0).

Has somebody already faced this?
Any help would be really lovely!

  • Ember 1.13.11
  • Ember Data 1.13.15
  • jQuery 1.11.3


EDIT: Magic minimal app reproducing the bug is out here!

Hope you'll enjoy it! And because I love you so much, I also offered a demo API endpoint on my server. Details in the FM!

BONUS! Know what is the coolest thing to put in a clipboard?
git clone https://github.com/imbrou/ember-data-headers-demo.git

Thanks in advance (-:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles