savon 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.7.1 (2010-01-10)
2
+ * The Hash of HTTP headers for SOAP calls is now public via Savon::Request#headers.
3
+ Patch for: http://github.com/rubiii/savon/issues/#issue/8
4
+
1
5
  == 0.7.0 (2010-01-09)
2
6
  This version comes with several changes to the public API!
3
7
  Pay attention to the following list and read the updated Wiki: http://wiki.github.com/rubiii/savon
@@ -60,6 +60,16 @@ module Savon
60
60
  # Returns the proxy URI.
61
61
  attr_reader :proxy
62
62
 
63
+ # Returns the HTTP headers for a SOAP request.
64
+ def headers
65
+ @headers ||= {}
66
+ end
67
+
68
+ # Sets the HTTP headers for a SOAP request.
69
+ def headers=(headers)
70
+ @headers = headers if headers.kind_of? Hash
71
+ end
72
+
63
73
  # Sets the +username+ and +password+ for HTTP basic authentication.
64
74
  def basic_auth(username, password)
65
75
  @basic_auth = [username, password]
@@ -98,7 +108,7 @@ module Savon
98
108
  # Logs the SOAP request.
99
109
  def log_request
100
110
  log "SOAP request: #{@soap.endpoint}"
101
- log http_header.map { |key, value| "#{key}: #{value}" }.join(", ")
111
+ log headers.merge(soap_headers).map { |key, value| "#{key}: #{value}" }.join(", ")
102
112
  log @soap.to_xml
103
113
  end
104
114
 
@@ -113,7 +123,7 @@ module Savon
113
123
  def request(type)
114
124
  request = case type
115
125
  when :wsdl then Net::HTTP::Get.new wsdl_endpoint
116
- when :soap then Net::HTTP::Post.new @soap.endpoint.path, http_header
126
+ when :soap then Net::HTTP::Post.new @soap.endpoint.path, headers.merge(soap_headers)
117
127
  end
118
128
  request.basic_auth *@basic_auth if @basic_auth
119
129
  yield request if block_given?
@@ -126,8 +136,8 @@ module Savon
126
136
  "#{@endpoint.path}?#{@endpoint.query}"
127
137
  end
128
138
 
129
- # Returns a Hash containing the header for an HTTP request.
130
- def http_header
139
+ # Returns a Hash containing the SOAP headers for an HTTP request.
140
+ def soap_headers
131
141
  { "Content-Type" => ContentType[@soap.version], "SOAPAction" => @soap.action }
132
142
  end
133
143
 
@@ -51,6 +51,17 @@ describe Savon::Request do
51
51
  @request.proxy.should == URI("")
52
52
  end
53
53
 
54
+ it "should have a getter for the HTTP headers which defaults to an empty Hash" do
55
+ @request.headers.should == {}
56
+ end
57
+
58
+ it "should have a setter for the HTTP headers" do
59
+ headers = { "some" => "thing" }
60
+
61
+ @request.headers = headers
62
+ @request.headers.should == headers
63
+ end
64
+
54
65
  it "should return the Net::HTTP object" do
55
66
  @request.http.should be_kind_of(Net::HTTP)
56
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-09 00:00:00 +01:00
12
+ date: 2010-01-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency