1- import Ember from 'ember' ;
21import Mixin from '@ember/object/mixin' ;
3- import { assign , merge } from '@ember/polyfills'
2+ import { assign } from '@ember/polyfills'
43import RSVP from 'rsvp' ;
54import fetch from 'fetch' ;
6-
7- import { serializeQueryParams } from 'ember-fetch/utils/serialize-query-params' ;
8-
9- const {
10- Logger : { warn }
11- } = Ember ;
5+ import { serializeQueryParams } from '../utils/serialize-query-params' ;
126
137/**
148 * Helper function to create a plain object from the response's Headers.
@@ -32,16 +26,13 @@ export function headersToObject(headers) {
3226 * @returns {Object }
3327 */
3428export function mungOptionsForFetch ( _options , adapter ) {
35- // This allows this mixin to be backward compatible with Ember < 2.5.
36- const combineObjs = ( assign || merge ) ;
37- const options = combineObjs ( {
29+ const options = assign ( {
3830 credentials : 'same-origin' ,
3931 } , _options ) ;
4032
4133 let adapterHeaders = adapter . get ( 'headers' ) ;
4234 if ( adapterHeaders ) {
43- // This double use of `combineObjs` is necessary because `merge` only accepts two arguments.
44- options . headers = combineObjs ( combineObjs ( { } , options . headers || { } ) , adapterHeaders ) ;
35+ options . headers = assign ( options . headers || { } , adapterHeaders ) ;
4536 }
4637
4738 // Default to 'GET' in case `type` is not passed in (mimics jQuery.ajax).
@@ -93,7 +84,7 @@ export function determineBodyPromise(response, requestData) {
9384 if ( response . ok && ( status === 204 || status === 205 || requestData . method === 'HEAD' ) ) {
9485 payload = { data : null } ;
9586 } else {
96- warn ( 'This response was unable to be parsed as json.' , payload ) ;
87+ console . warn ( 'This response was unable to be parsed as json.' , payload ) ;
9788 }
9889 }
9990 return payload ;
0 commit comments