2017-11-16 02:11:24 +00:00
|
|
|
import Ember from 'ember';
|
2017-11-14 18:50:29 +00:00
|
|
|
import fetch from 'fetch';
|
2017-12-12 02:27:53 +00:00
|
|
|
import config from '../config/environment';
|
2017-11-14 18:50:29 +00:00
|
|
|
|
|
|
|
// The ember-fetch polyfill does not provide streaming
|
2017-11-16 02:11:24 +00:00
|
|
|
// Additionally, Mirage/Pretender does not support fetch
|
2017-12-12 02:27:53 +00:00
|
|
|
const mirageEnabled = config['ember-cli-mirage'] && config['ember-cli-mirage'].enabled !== false;
|
|
|
|
const fetchToUse = Ember.testing || mirageEnabled ? fetch : window.fetch || fetch;
|
2017-11-14 18:50:29 +00:00
|
|
|
|
|
|
|
export default fetchToUse;
|