mpyw / axios-case-converter

Axios transformer/interceptor that converts snake_case/camelCase
MIT License
160 stars 18 forks source link

Cannot read properties of undefined (reading '_isAMomentObject') #49

Closed sergeushenecz closed 2 years ago

sergeushenecz commented 2 years ago

After upgrade to new version. I getting error. My value is moment js date.

mpyw commented 2 years ago

After upgrade to new version.

No, it's reproducible since version axios-case-convereter@0.9.0 and axios@0.27.2. The transforming logic has not been changed.

My value is moment js date.

In short, don't pass moment() directly into the payload. Call moment().toJSON() explicitly.


Optionally, we can reverse transformRequest options order to precede axios default transformer execution.

However, this would be a breaking change. In addition, we need to restore its original type after it has been transformed into string. Therefore, without a well-tested PR, there are no plans to accept the change so far.

mpyw commented 2 years ago

Still isPlainObject logic should be fixed, okay