Moya: Encode url parameters in .post request

Created on 17 Jun 2017  路  8Comments  路  Source: Moya/Moya

Hello

I have a .post request with parameters to be sent in url like following:
http://xxxxx/token?userName=Mike&password=123
but the "?" is encoded to "%3F"
http://xxxxx/token%3FuserName=Mike&password=123

I tried putting them in the parameters, but in .post requests it is sent as body not url parameters

Any Help please?

question

Most helpful comment

Hey @BasantAshraf. Use URLEncoding(destination: .queryString) as your parameterEncoding and add userName & password as your parameters. Let us know if it worked!

All 8 comments

Hey @BasantAshraf. Use URLEncoding(destination: .queryString) as your parameterEncoding and add userName & password as your parameters. Let us know if it worked!

it works! Thanx a million for your fast response

@sunshinejr I have tested it but the url is send empty without the parameters. what can be the issue with this ?

me too and .queryString is useless

cool

@BasantAshraf Hi,I have a same question. Can you paste the code?

@BasantAshraf yes, I solved the problem!

Hey @shenxiewei, great to hear! Can you share your solution with us? Maybe it'll help someone else 馃槈

Was this page helpful?
0 / 5 - 0 ratings