Sha256: 2e3c25001c704766aad38849beb9fbefb450e0a16c113ac0c283008c4757d66b

Contents?: true

Size: 954 Bytes

Versions: 3

Compression:

Stored size: 954 Bytes

Contents

module Savon
  module SOAP
    class Request

    private

      def configure(http)
        http.url = soap.endpoint
        if soap.has_parts? # do multipart stuff if soap has parts
          request_message = soap.request_message
          # takes relevant http headers from the "Mail" message and makes
          # them Net::HTTP compatible
          request_message.header.fields.each do |field|
            http.headers[field.name] = field.to_s
          end
          #request.headers["Content-Type"] << %|; start="<savon_soap_xml_part>"|
          request_message.body.set_sort_order soap.parts_sort_order if soap.parts_sort_order && soap.parts_sort_order.any?
          http.body = request_message.body.encoded
        else
          http.body = soap.to_xml
        end
        http.headers["Content-Type"] ||= CONTENT_TYPE[soap.version]
        http.headers["Content-Length"] = http.body.bytesize.to_s
        http
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
savon-multipart-1.2.0 lib/savon/multipart/soap/request.rb
savon-multipart-1.1.0 lib/savon/multipart/soap/request.rb
savon-multipart-1.0.0 lib/savon/multipart/soap/request.rb