0

I'm on a website using Ruby and Mechanize to pass a POST query to a site. The query that gets to the site, based on firebug, looks like this

param.PrdNo=-1&param.Type=Prop&param.RequestType=Normal&param.PropParams%5B0%5D.CrId=Base-MLB+Su+Washington+Na%40Atlanta+Brave 

The QUERY I pass in my ruby code is this

QUERY = { "param.PrdNo" => "-1", "param.Type" => "Prop", "param.RequestType" => "Normal", "param.PropParams[0].CrId" => "Base-MLB+Su+Washington+Na@Atlanta+Brave"} doc.agent.post(url, QUERY, content_type) 

The logger prints out the following

D, [2014-08-10T14:46:24.844744 #15801] DEBUG -- : query: "param.PrdNo=-1&param.Type=Prop&param.RequestType=Normal&param.PropParams%5B0%5D.CrId=Base-MLB%2BSu%2BWashington%2BNa%40Atlanta%2BBrave" 

How do I get my code to make a query that looks like the query from firebug?

1
  • have you tried QUERY.to_json? Commented Aug 10, 2014 at 23:53

1 Answer 1

1

You could post the string:

vars = "param.PrdNo=-1&param.Type=Prop&param.RequestType=Normal&param.PropParams%5B0%5D.CrId=Base-MLB+Su+Washington+Na%40Atlanta+Brave" doc.agent.post url, vars, content_type 

It will get sent as the raw post body.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.