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 = {})
38
38
if method == :get && !query_string . blank?
39
39
path_or_query += "?#{ query_string } "
40
40
else
41
- if respond_to? ( :raw_post )
41
+ if respond_to? ( :raw_post )
42
42
params_or_body = raw_post
43
43
else
44
44
formatter = RspecApiDocumentation . configuration . post_body_formatter
45
45
case formatter
46
46
when :json
47
- params_or_body = params . to_json
47
+ params_or_body = params . empty? ? nil : params . to_json
48
48
when :xml
49
49
params_or_body = params . to_xml
50
50
when Proc
Original file line number Diff line number Diff line change 477
477
RspecApiDocumentation . instance_variable_set ( :@configuration , RspecApiDocumentation ::Configuration . new )
478
478
end
479
479
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
+
480
492
post "/orders" do
481
493
parameter :page , "Page to view"
482
494
You can’t perform that action at this time.
0 commit comments