I need to do a POST request for a URL containing curly braces and colons:
http://192.168.178.23/emoncms/input/post.json?json={power:200}&apikey=671b341330a7b1a4c20bf8ae7dd1faf1&time=12345677890
I tried this:
uri = URI("http://192.168.178.23/emoncms/input/post.json")
res = Net::HTTP.post_form(uri, "json" => "{power:200}", "apikey" => "671b341330a7b1a4c20bf8ae7dd1faf1", "time" => "1234567890")
But this results in:
json=%7BPVCurrent%3A3.0%7D&apikey=671b341330a7b1a4c20bf8ae7dd1faf1&time=1406144643
The service I am calling can't parse this string. How can I force ruby not to encode these values?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…