I am using Net::HTTP
for sending GET
request to an API Server to fetch some data based on some configurations as below:
# method to fetch shirt sample details from api server
def fetch_shirt_sample(shirt, query_params)
path = "http://myapiserver.com/shirts/#{shirt.id}/shirt_sample"
url = URI.parse(path)
req = Net::HTTP::Get.new(url.path + '?' + query_params)
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
JSON.parse(res.body)
end
What is wrong or weird I found is above method works for following query params:
"&name=medium_shirt&color=red&configs=[\"full_length\",\"no_collar\",\"casual\"]"
but doesn't even send GET
request for following query params:
"&name=medium_shirt&color=red&configs=[\"full_length\",\"15\",\"43\",\"30\"]"
Could anyone help me to understand what is wrong in the above setup?