Closed
Description
Unless I am misunderstanding, the query_string
parameter should only be passed on GET requests. I was having trouble this morning testing a POST due to it passing the query_string
on top of my params
that were being passed.
require 'spec_helper'
require 'rspec_api_documentation/dsl'
resource "User" do
header 'Accept', 'application/json'
header 'Content-Type', 'application/json'
post "user/:id/get_my_foo.json" do
parameter :foo_id, "Foo ID you want", required: true
let(:id){ 1 }
let)(:foo_id){ 2 }
example_request 'Get the persons Foo' do
# fails on request due to extra query_string
end
end
end
this is the error that occurs
Failure/Error: do_request
MultiJson::LoadError:
795: unexpected token at 'foo_id=2'
I discovered I could resolve this by overriding the params by let
ing raw_post
.
let(:raw_post){ {foo_id: 2}.to_json }
I shouldn't have to do this according to the documentation though. Am I doing something wrong or is this a bug?
Thank you for your time. I love this project! Keep up the amazing work!
Metadata
Metadata
Assignees
Labels
No labels