ember-fetch + fastboot + ember-data sadness
See original GitHub issuefastboot and fetch share the same extension point in ember-data, and today they do not work together.
Long-term, I suspect fastboot should provide a XMLHTTPRequest
global, and a fetch
global. That way it doesn’t interfere in high level code, and would also “just work” with things like pretender/mirage.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:16
Top Results From Across the Web
Quickstart - Ember FastBoot
FastBoot Quickstart. Creating a New Ember App. This quickstart guide will walk you through creating a simple Ember app that fetches data from...
Read more >Ember Data - Part 2 - Ember Guides
In this chapter, we will work on removing some code duplication in our route handlers, by switching to using Ember Data to manage...
Read more >Ember Data: A Tutorial and Examples of the Ember.js ... - Toptal
Ember Data is a library for robustly managing model data in Ember.js applications. Ember Data provides a more flexible and streamlined development workflow, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ehubbell Totally.
The latest ember-simple-auth has deprecated authorizers… So I had to change some things a few weeks ago. Now that
ajaxOptions
hook I pasted above looks a little different.Because we are using basic auth to protect our staging environment, and we are using fastboot, and simple auth uses the ‘Authorization’ header, and fastboot will not let us change that default… we had to change the name of our access token key to something that does not use
Authorization
. We usedX-Access-Token
and had to subsequently change our authorization code in devise to use a diff key.Here is my entire application adapter:
Hope that helps.
I also ran into an nearly identical issue with
ember-data
ember-fetch
ember-cli-fastboot
andember-simple-auth
Ember-fetch’s ajaxOption’s does not call super, which results in any other extensions of your application adapter not having the opportunity to set headers or anything like that. The current implementation of ember-fetch’s ajaxOptions do not allow this to run.
This breaks
ember-simple-auth
because theember-simple-auth
’s adapter mixin needs to set your auth header.My workaround is to manually set the headers I need after ember-fetch has run: