File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
lib/rspec_api_documentation/dsl Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,13 @@ def do_request(extra_params = {})
3838 if method == :get && !query_string . blank?
3939 path_or_query += "?#{ query_string } "
4040 else
41- if respond_to? ( :raw_post )
41+ if respond_to? ( :raw_post )
4242 params_or_body = raw_post
4343 else
4444 formatter = RspecApiDocumentation . configuration . post_body_formatter
4545 case formatter
4646 when :json
47- params_or_body = params . to_json
47+ params_or_body = params . empty? ? nil : params . to_json
4848 when :xml
4949 params_or_body = params . to_xml
5050 when Proc
Original file line number Diff line number Diff line change 477477 RspecApiDocumentation . instance_variable_set ( :@configuration , RspecApiDocumentation ::Configuration . new )
478478 end
479479
480+ get "/orders" do
481+ specify "formatting by json without parameters" do
482+ RspecApiDocumentation . configure do |config |
483+ config . post_body_formatter = :json
484+ end
485+
486+ expect ( client ) . to receive ( method ) . with ( path , nil , nil )
487+
488+ do_request
489+ end
490+ end
491+
480492 post "/orders" do
481493 parameter :page , "Page to view"
482494
You can’t perform that action at this time.
0 commit comments