Closed
Description
I have to use an API that asks me to make a POST and put one parameter in the URL, others as JSON in the body.
If I had to only send the URL parameter, I would use URLEncoding.queryString
If I had to only send the body parameters, I would use JSONEncoding.default
But how can I send both with Moya? As far as I know, Moya only allow 1 parameter encoding.
As a workaround, in my implementation of TargetType I left the body params in parameters
and 'parameterEncoding` to JSONEncoding.default, and tried to put the query parameter directly in the path, but doing so the '?' is encoded as '%3F' while it shouldn't and the API returns an error.
Using Moya 8.0.3
Activity
amaurydavid commentedon Apr 20, 2017
Nvm, I found some inspiration from #909 and created a custom encoding.
That's not very generic but I someone has the same issue, here is something to start with :)
hardikamal commentedon Sep 3, 2018
@amaurydavid parameter.minus is not working. And can you help out on how to use this?
amaurydavid commentedon Sep 4, 2018
I no longer have access to that code but by the look of it, the minus function was just building a new dictionary with only entries that should be json encoded. Kinda the opposite of the filter above.