I am sending a post request from a Rails app, to an ExpressJS app. In postman it works, however when i send the post request from the Rails app, the params look fine on the rails end but then when the ExpressJS app receives them, they're different?? Specifically in the nested hashes(forms_list). Help. Here is the data:
These are the rails params:
{:respond_url=>"http://localhost:3000/api/v1/crawls/rover_page", :error_url=>"http://localhost:3000/api/v1/crawls/rover_error", :crawl_id=>"5bbf971e0928538630743eb8", :dimension_id=>"eda510527346f84479a6", :next_page=>"", :back_button=>"", :start_url=>"https://hrlb.oregon.gov/bspa/licenseelookup/", :forms_list=>[{"select"=>{"//td[select]/select"=>"lastname"}, "text_field"=>{"//td[2]/input[1]"=>"bac"}}], :clicks_list=>["//input[@type='submit']"], :links_selector=>"//table[2]//tr[td[a]]//td[1]/a", :command_list=>["start_url", "form", "click", "record_links"]}
They are sent with RestClient like so:
new_crawl = RestClient.post("#{ENV['ROVER_URL']}/crawl/new_crawl", params)
These are the params sent in postman that work:
{"respond_url": "http://localhost:3003/api/v1/crawls/rover_page",
"error_url": "http://localhost:3003/api/v1/crawls/rover_error",
"crawl_id": "5bbcfd36092853736bc872d7",
"dimension_id": "123",
"next_page": "",
"back_button": "",
"start_url":"https://hrlb.oregon.gov/bspa/licenseelookup/",
"forms_list":[{"text_field":{"//td[2]/input[1]": "bac"}, "select": {"//td[select]/select": "lastname"}}],
"clicks_list": ["//input[@type='submit']"],
"links_selector": "//table[2]//tr[td[a]]//td[1]/a",
"command_list": ["start_url", "form", "click", "record_links"]
}
And here is the screenshot of how it is interpreted on the ExpressJS side:
And THIS is how the data should look (this was sent with the postman data):