angular2-rest icon indicating copy to clipboard operation
angular2-rest copied to clipboard

Only json.stringify when the content type is application/json

Open Nehon opened this issue 9 years ago • 0 comments

Hey really nice library you have here.

I stumbled on an issue though and figured out that the body (added with @Body) is always passed to JSON.stringify(). It's a problem when you want to send something that is not json. https://github.com/Paldom/angular2-rest/blob/master/angular2-rest.ts#L192

It's very convenient of course when you want to send JSON, which is the case most of the time. But IMO this process should only be done when the content type is set to application/json.

It would be awesome to support any other content type encoding...but quite cumbersome, so I suggest to let the user format the body the way he wants when the content type is not application/json.

Nehon avatar May 02 '16 06:05 Nehon