open-nomad/ui/app/utils/fetch.js
Michael Lange 87670753e5 Never use native fetch when mirage is enabled
Unfortunately, Mirage/Pretender don't support fetch
2018-01-17 09:02:04 -08:00

11 lines
420 B
JavaScript

import Ember from 'ember';
import fetch from 'fetch';
import config from '../config/environment';
// The ember-fetch polyfill does not provide streaming
// Additionally, Mirage/Pretender does not support fetch
const mirageEnabled = config['ember-cli-mirage'] && config['ember-cli-mirage'].enabled !== false;
const fetchToUse = Ember.testing || mirageEnabled ? fetch : window.fetch || fetch;
export default fetchToUse;