lib/savon/request.rb in savon-0.7.2 vs lib/savon/request.rb in savon-0.7.3
- old
+ new
@@ -4,11 +4,11 @@
#
# Handles both WSDL and SOAP HTTP requests.
class Request
# Content-Types by SOAP version.
- ContentType = { 1 => "text/xml", 2 => "application/soap+xml" }
+ ContentType = { 1 => "text/xml;charset=UTF-8", 2 => "application/soap+xml;charset=UTF-8" }
# Whether to log HTTP requests.
@@log = true
# The default logger.
@@ -106,11 +106,11 @@
private
# Logs the SOAP request.
def log_request
log "SOAP request: #{@soap.endpoint}"
- log headers.merge(soap_headers).map { |key, value| "#{key}: #{value}" }.join(", ")
+ log soap_headers.merge(headers).map { |key, value| "#{key}: #{value}" }.join(", ")
log @soap.to_xml
end
# Logs the SOAP response.
def log_response
@@ -120,13 +120,13 @@
# Returns a Net::HTTP request for a given +type+. Yields the request
# to an optional block.
def request(type)
request = case type
- when :wsdl then Net::HTTP::Get.new @endpoint.to_s
- when :soap then Net::HTTP::Post.new @soap.endpoint.to_s, headers.merge(soap_headers)
+ when :wsdl then Net::HTTP::Get.new @endpoint.request_uri
+ when :soap then Net::HTTP::Post.new @soap.endpoint.request_uri, soap_headers.merge(headers)
end
- request.basic_auth *@basic_auth if @basic_auth
+ request.basic_auth(*@basic_auth) if @basic_auth
yield request if block_given?
request
end
# Returns a Hash containing the SOAP headers for an HTTP request.