savon 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/lib/savon/soap/fault.rb +12 -1
- data/lib/savon/soap/xml.rb +1 -1
- data/lib/savon/version.rb +1 -1
- data/spec/savon/soap/fault_spec.rb +6 -1
- data/spec/savon/soap/response_spec.rb +2 -2
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.8.5 (2011-01-28)
|
2
|
+
|
3
|
+
* Fix for [issue #146](https://github.com/rubiii/savon/issues/146) ([98655c](https://github.com/rubiii/savon/commit/98655c)).
|
4
|
+
|
5
|
+
* Fix for [issue #147](https://github.com/rubiii/savon/issues/147) ([252670](https://github.com/rubiii/savon/commit/252670)).
|
6
|
+
|
1
7
|
## 0.8.4 (2011-01-26)
|
2
8
|
|
3
9
|
* Fix for issues [issue #130](https://github.com/rubiii/savon/issues/130) and [#134](https://github.com/rubiii/savon/issues/134)
|
data/lib/savon/soap/fault.rb
CHANGED
@@ -19,7 +19,7 @@ module Savon
|
|
19
19
|
|
20
20
|
# Returns whether a SOAP fault is present.
|
21
21
|
def present?
|
22
|
-
@present ||= http.
|
22
|
+
@present ||= http.code == 500 && http.body.include?("Fault>") && (soap1_fault? || soap2_fault?)
|
23
23
|
end
|
24
24
|
|
25
25
|
# Returns the SOAP fault message.
|
@@ -35,6 +35,17 @@ module Savon
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
+
# Returns whether the response contains a SOAP 1.1 fault.
|
39
|
+
def soap1_fault?
|
40
|
+
http.body.include?("faultcode>") && http.body.include?("faultstring>")
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns whether the response contains a SOAP 1.2 fault.
|
44
|
+
def soap2_fault?
|
45
|
+
http.body.include?("Code>") && http.body.include?("Reason>")
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns the SOAP fault message by version.
|
38
49
|
def message_by_version(fault)
|
39
50
|
if fault[:faultcode]
|
40
51
|
"(#{fault[:faultcode]}) #{fault[:faultstring]}"
|
data/lib/savon/soap/xml.rb
CHANGED
@@ -135,7 +135,7 @@ module Savon
|
|
135
135
|
def to_xml
|
136
136
|
@xml ||= tag(builder, :Envelope, complete_namespaces) do |xml|
|
137
137
|
tag(xml, :Header) { xml << header_for_xml } unless header_for_xml.empty?
|
138
|
-
tag(xml, :Body) { xml.tag!(*input) { xml << body_to_xml } }
|
138
|
+
input.nil? ? tag(xml, :Body) : tag(xml, :Body) { xml.tag!(*input) { xml << body_to_xml } }
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
data/lib/savon/version.rb
CHANGED
@@ -32,6 +32,11 @@ describe Savon::SOAP::Fault do
|
|
32
32
|
it "should return false unless the HTTP response contains a SOAP fault" do
|
33
33
|
no_fault.should_not be_present
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should return false if the HTTP response code is not 500" do
|
37
|
+
fault = Savon::SOAP::Fault.new new_response(:code => 200, :body => Fixture.response(:soap_fault))
|
38
|
+
fault.should_not be_present
|
39
|
+
end
|
35
40
|
end
|
36
41
|
|
37
42
|
[:message, :to_s].each do |method|
|
@@ -80,7 +85,7 @@ describe Savon::SOAP::Fault do
|
|
80
85
|
end
|
81
86
|
|
82
87
|
def new_response(options = {})
|
83
|
-
defaults = { :code =>
|
88
|
+
defaults = { :code => 500, :headers => {}, :body => Fixture.response(:authentication) }
|
84
89
|
response = defaults.merge options
|
85
90
|
|
86
91
|
HTTPI::Response.new response[:code], response[:headers], response[:body]
|
@@ -159,12 +159,12 @@ describe Savon::SOAP::Response do
|
|
159
159
|
def soap_response(options = {})
|
160
160
|
defaults = { :code => 200, :headers => {}, :body => Fixture.response(:authentication) }
|
161
161
|
response = defaults.merge options
|
162
|
-
|
162
|
+
|
163
163
|
Savon::SOAP::Response.new HTTPI::Response.new(response[:code], response[:headers], response[:body])
|
164
164
|
end
|
165
165
|
|
166
166
|
def soap_fault_response
|
167
|
-
soap_response :body => Fixture.response(:soap_fault)
|
167
|
+
soap_response :code => 500, :body => Fixture.response(:soap_fault)
|
168
168
|
end
|
169
169
|
|
170
170
|
def http_error_response
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 5
|
10
|
+
version: 0.8.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|