troyanskiy/ngx-resource

Body serialization

kptLucek opened this issue · 3 comments

Hi

Is there any chance to change way, that body is being serialized?

Right now it's made by JSON.stringify, but... it resuts in many problems with backend API im using for that project.

The perfect way for me, would be to choose between stringify and for example URLSearchParams (aka, NG1 $httpParamSerializer) described in here.

If it's not possible to implement any soon, then any workaround more than welcome.

Hello!
Thanks for the issue.
I've just implemented that for you. Published 3.3.0

  1. You can overwrite Resource method $bodySerializer(body: any): string to implement customs serializer.
  2. Or you can define if with ResourceAction decorator bodySerializer(body: any): string to implement custom serializer per resource method.

Works like a charm!

I'm glad to hear that.