views:

91

answers:

1

Our app provides an API that people can use to submit URLs like this:

curl -X POST http://app.local/resource -d'url=http://news.google.com/newshl=en&q=obama&um=1&ie=UTF-8&output=rss' 

Unfortunately, it seems that Rails messes up with this param. Any idea on how to fix this? See the log below :

Processing ApplicationController#index (for 127.0.0.1 at 2010-06-08 19:03:09) [POST]
  Parameters: {"um"=>"1", "url"=>"http://news.google.com/newshl=en", "output"=>"rss", "q"=>"obama", "ie"=>"UTF-8"}

I would expect the following :

  Parameters: {"url"=>"hhttp://news.google.com/newshl=en&q=obama&um=1&ie=UTF-8&output=rss"}
+1  A: 

What exactly Rails messes up?

If you are referring to the fact that it didn't get complete Google URL (i.e. separated it to output, q and other params) that's because you need to encode '&' character if you want to use it as a part of a value. Something like:

curl -X POST http://app.local/resource -d'url=http://news.google.com/newshl=en%26q=obama%26um=1%26ie=UTF-8%26output=rss' 
Slobodan Kovacevic
the problem is that we have several other params, that are not in the url param. How can I make the difference between them?
Julien Genestoux
Where do you have more params?
Slobodan Kovacevic
In the POST query, thre is more than just the POST, and I can't really make the difference between the POST params and the query string params of the url param.
Julien Genestoux
Slobodan Kovacevic