open-nomad/ui/app/utils/fetch.js

15 lines
466 B
JavaScript
Raw Normal View History

import Ember from 'ember';
2017-11-14 18:50:29 +00:00
import fetch from 'fetch';
import config from '../config/environment';
2017-11-14 18:50:29 +00:00
// The ember-fetch polyfill does not provide streaming
// Additionally, Mirage/Pretender does not support fetch
const mirageEnabled =
config.environment !== 'production' &&
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;