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
|
2018-03-22 05:04:29 +00:00
|
|
|
const mirageEnabled =
|
|
|
|
config.environment !== 'production' &&
|
|
|
|
config['ember-cli-mirage'] &&
|
|
|
|
config['ember-cli-mirage'].enabled !== false;
|
|
|
|
|
2017-12-12 02:27:53 +00:00
|
|
|
const fetchToUse = Ember.testing || mirageEnabled ? fetch : window.fetch || fetch;
|
2017-11-14 18:50:29 +00:00
|
|
|
|
|
|
|
export default fetchToUse;
|