axios-logger icon indicating copy to clipboard operation
axios-logger copied to clipboard

data is stringified even though data is set to false

Open alex-marczinek opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug

Set the data config to false : setGlobalConfig({ data: false, });

With version 2.5.0 there was no error thrown when logging requests where the data field contained circular data. Since version 2.6.0 however the data field will be stringified even though data is set to false:

See 'string-builder.ts':

 makeData(data: object) {
      const str = typeof data === `string` ? data : JSON.stringify(data);
      if(this.config.data && data) this.printQueue.push(str);
      return this;
}

I would suggest to only stringify the data if this.config.data is true.

alex-marczinek avatar Nov 23 '21 11:11 alex-marczinek

Thank you for report. I will check and fix. It will be release on 2.6.1 soon.

hg-pyun avatar Nov 24 '21 14:11 hg-pyun

I've just put up a PR to fix this: https://github.com/hg-pyun/axios-logger/pull/114

bricka avatar Jun 29 '22 07:06 bricka