You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using ember-fetch with ember data and I have a custom method in one of my adapters that returns csv instead of json.
The function determine-body-promise seem to emit a warning message in both production and development and is not ideal to have my entire csv payload, or any payload to be frank, be printed out in the console in production(development is fine).
My suggestion is the following.
// Add this line. You'll probably need to install ember-cli-babel as mentioned in// https://github.com/emberjs/ember.js/issues/18062import{DEBUG}from'@glimmer/env';/** * Function that always attempts to parse the response as json, and if an error is thrown, * returns `undefined` if the response is successful and has a status code of 204 (No Content), * or 205 (Reset Content) or if the request method was 'HEAD', and the plain payload otherwise. */
export defaultfunctiondetermineBodyPromise(response: Response,requestData: JQueryAjaxSettings): Promise<object|string|undefined>{returnresponse.text().then(function(payload){
let ret: string|object|undefined=payload;try{ret=JSON.parse(payload);}catch(error){if(!(errorinstanceofSyntaxError)){throwerror;}conststatus=response.status;if(response.ok&&(status===204||status===205||requestData.method==='HEAD')){ret=undefined;}elseif(DEBUG){// Check if we are in development mode.console.warn('This response was unable to be parsed as json.',payload);}}returnret;});}
The text was updated successfully, but these errors were encountered:
I'm using ember-fetch with ember data and I have a custom method in one of my adapters that returns csv instead of json.
The function
determine-body-promise
seem to emit a warning message in both production and development and is not ideal to have my entire csv payload, or any payload to be frank, be printed out in the console in production(development is fine).My suggestion is the following.
The text was updated successfully, but these errors were encountered: