I am trying to access a private API endpoint that accepts a phone number, including the country code, in the URL query parameters. Because the phone number has to include the "+", the phone number has to be encoded (i.e. the '+' becomes '%2B')
When I call this:
RestClient.get("mytestserver.com/get_info?phone=%2B11231231234")
in ruby, i get back an invalid response, that indicates its hitting the server, but the value isn't being read correctly.
The same call in the browser, works.
I was able to get it to work using the Net::HTTP class, by doing the following:
uri = URI("http://mytestserver.com/get_info")
uri.query = URI.encode_www_form({phone: "+11231231234"})
response = Net::HTTP.get_response(uri)
But I wanted to see if there was a way to do it via RestClient?