diff --git a/templates/ruby/lib/container/client.rb.twig b/templates/ruby/lib/container/client.rb.twig index 8e769ce06..0eb2f86fb 100644 --- a/templates/ruby/lib/container/client.rb.twig +++ b/templates/ruby/lib/container/client.rb.twig @@ -213,7 +213,7 @@ module {{ spec.title | caseUcfirst }} when 'application/json' payload = params.to_json when 'multipart/form-data' - payload = "--#{@boundary}\r\n" + encode_form_data(params) + payload = encode_form_data(params) + "--#{@boundary}--\r\n" headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}" else payload = encode(params) @@ -284,16 +284,18 @@ module {{ spec.title | caseUcfirst }} else post_body = [] if value.instance_of? InputFile - post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.filename}\"\r\n" - post_body << "Content-Type: #{value.mime_type}\r\n\r\n" + post_body << "--#{@boundary}" + post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.filename}\"" + post_body << "Content-Type: #{value.mime_type}" + post_body << "" post_body << value.data - post_body << "\r\n--#{@boundary}--\r\n" - else - post_body << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" - post_body << "#{value.to_s}" - post_body << "\r\n--#{@boundary}\r\n" + else + post_body << "--#{@boundary}" + post_body << "Content-Disposition: form-data; name=\"#{key}\"" + post_body << "" + post_body << value.to_s end - post_body.join + post_body.join("\r\n") + "\r\n" end end