-2

I need to send get request on server with query parameters, but query contains symbols + and spaces. How I can encode it to url code? Like symbol plus to %2B and spaces to %20.

Basic URLQueryItem don't have URL code argument and didn't work correctly (just send + like + without encode).

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
noW0rds
  • 1
  • 2

1 Answers1

0

you need to put URLEncoding.default in ParameterEncoding and adding key values in Parameter like

case .callingAPIs(let getValue):
   return ["value" : getValue]


let encoding: ParameterEncoding = {
     return URLEncoding.default
}

then you will get your desire result

Chandaboy
  • 1,302
  • 5
  • 10