I am using rails4 + rspec 3. I want to make HTTP calls and pass both parameters (for example, JSON body or request string) as well as HTTP headers. I was able to go through one of these two, but not both.
when i try something like:
post api_v1_post_path(@myid), {} , {"X-Some-Header" => "MyValue"}
it works fine and the headers are fine, but if I am something like:
post api_v1_post_path(@myid), {"myparam" => "myvalue"} , {"X-Some-Header" => "MyValue"}
I get the following error:
Failure/Error: post api_v1_post_path(@myid), {"myparam" =>"myvalue"}, headers
ActionDispatch::ParamsParser::ParseError:
795: unexpected token at 'myparam'
Any ideas?
source
share