File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
modules/swagger-codegen/src/main/resources/ruby/swagger
samples/client/petstore/ruby/lib/swagger_client/swagger Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -120,14 +120,16 @@ module {{moduleName}}
120
120
# For form parameters, remove empty value
121
121
def outgoing_body
122
122
# http form
123
- if @body.nil? && @form_params && !@form_params.empty?
123
+ if headers['Content-Type'] == 'application/x-www-form-urlencoded'
124
124
data = form_params.dup
125
125
data.each do |key, value|
126
126
data[key] = value.to_s if value && !value.is_a?(File) # remove emtpy form parameter
127
127
end
128
128
data
129
- else # http body is JSON
129
+ elsif @body # http body is JSON
130
130
@body.is_a?(String) ? @body : @body.to_json
131
+ else
132
+ nil
131
133
end
132
134
end
133
135
Original file line number Diff line number Diff line change @@ -119,14 +119,16 @@ def body=(value)
119
119
# For form parameters, remove empty value
120
120
def outgoing_body
121
121
# http form
122
- if @body . nil? && @form_params && ! @form_params . empty?
122
+ if headers [ 'Content-Type' ] == 'application/x-www-form-urlencoded'
123
123
data = form_params . dup
124
124
data . each do |key , value |
125
125
data [ key ] = value . to_s if value && !value . is_a? ( File ) # remove emtpy form parameter
126
126
end
127
127
data
128
- else # http body is JSON
128
+ elsif @body # http body is JSON
129
129
@body . is_a? ( String ) ? @body : @body . to_json
130
+ else
131
+ nil
130
132
end
131
133
end
132
134
You can’t perform that action at this time.
0 commit comments