lib/multipart_post/parts.rb in docusign_rest-0.0.9 vs lib/multipart_post/parts.rb in docusign_rest-0.1.1

- old
+ new

@@ -1,12 +1,19 @@ require 'multipart_post' require 'parts' Parts::ParamPart.class_eval do - def build_part(boundary, name, value) - part = "\r\n" #Add a leading carriage return line feed (not sure why DocuSign requires this) + def build_part(boundary, name, value, headers = {}) + part = "" part << "--#{boundary}\r\n" - part << "Content-Type: application/json\r\n" #Add the content type which isn't present in the multipart-post gem, but DocuSign requires + + # TODO (2014-02-03) jonk => multipart-post seems to allow for adding + # a configurable header, hence the headers param in the method definition + # above. However, I can't seem to figure out how to acctually get it passed + # all the way through to line 42 of the Parts module in the parts.rb file. + # So for now, we still monkeypatch the content-type in directly. + + part << "Content-Type: application/json\r\n" part << "Content-Disposition: form-data; name=\"#{name.to_s}\"\r\n" part << "\r\n" part << "#{value}\r\n" end end