github.com/hernad/nomad@v1.6.112/ui/app/utils/fetch.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import fetch from 'fetch';
     7  import config from '../config/environment';
     8  
     9  // The ember-fetch polyfill does not provide streaming
    10  // Additionally, Mirage/Pretender does not support fetch
    11  const mirageEnabled =
    12    config.environment !== 'production' &&
    13    config['ember-cli-mirage'] &&
    14    config['ember-cli-mirage'].enabled !== false;
    15  
    16  const fetchToUse = mirageEnabled ? fetch : window.fetch || fetch;
    17  
    18  export default fetchToUse;