I'm pretty sure SoberSwag ignores request body params on GET requests (and that's presumably the expected behavior because the HTTP spec says to do that AFAICT). However, if you're not familiar with the behavior of the HTTP spec and create an endpoint like this:
define :get, :index, '/foo' do
summary 'Foo'
request_body(reporting: true) do
attribute :bar, SoberSwag::Reporting::Input.text
end
response(:ok, 'the foos requested', Core::Types.reporting_list_serializer_of(FooOutput))
end
def index
puts parsed_body.inspect # this prints an empty parsed body even when you pass `bar` as a request body param.
end
Then you'll just get an empty parsed_body object in the action, and that leads to very confusing problems while developing. SoberSwag should raise if the developer tries to define a request_body on a GET endpoint.
I'm pretty sure SoberSwag ignores request body params on GET requests (and that's presumably the expected behavior because the HTTP spec says to do that AFAICT). However, if you're not familiar with the behavior of the HTTP spec and create an endpoint like this:
Then you'll just get an empty
parsed_bodyobject in the action, and that leads to very confusing problems while developing. SoberSwag should raise if the developer tries to define a request_body on a GET endpoint.