php-mod/curl

Automatically set header in `prepareJsonPayload`

mskocik opened this issue · 3 comments

I would suggest to automatically set header Content-type: application/json when calling prepareJsonPayload. Typically when doing post as json.
What do you think? I could prepare PR for this change.

nadar commented

Hi @mskocik

I totally agree, but this would introduce backwards compatibility break. So we need (even its ugly) another parameter for doing this, like $contenTypeJson which is false by default.

With this in mind, yes please send a PR 👍 Thanks

nadar commented

We are now in 3.0 dev branch, i will implement a solution for this, maybe a new method.

I agree with new method. Because although I think it's right to set headers in prepareJsonPayload it isn't that flexible. That's also the reason why I haven't pushed to PR.