diff --git a/bin/httparty b/bin/httparty index 6500623..72bda77 100755 --- a/bin/httparty +++ b/bin/httparty @@ -73,27 +73,6 @@ if ARGV.empty? STDERR.puts "USAGE: #{$0} [options] [url]" end -# 1.8.6 has mistyping of transitive in if statement -module REXML #:nodoc: - class Document < Element - def write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) - if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) - output = Output.new( output, xml_decl.encoding ) - end - formatter = if indent > -1 - if transitive - REXML::Formatters::Transitive.new( indent, ie_hack ) - else - REXML::Formatters::Pretty.new( indent, ie_hack ) - end - else - REXML::Formatters::Default.new( ie_hack ) - end - formatter.write( self, output ) - end - end -end - if opts[:output_format].nil? response = HTTParty.send(opts[:action], ARGV.first, opts) puts "Status: #{response.code}" diff --git a/lib/core_extensions.rb b/lib/core_extensions.rb index e24b837..ff004db 100644 --- a/lib/core_extensions.rb +++ b/lib/core_extensions.rb @@ -351,3 +351,24 @@ end class BlankSlate #:nodoc: instance_methods.each { |m| undef_method m unless m =~ /^__/ } end + +# 1.8.6 has mistyping of transitive in if statement +module REXML #:nodoc: + class Document < Element #:nodoc: + def write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) + if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) + output = Output.new( output, xml_decl.encoding ) + end + formatter = if indent > -1 + if transitive + REXML::Formatters::Transitive.new( indent, ie_hack ) + else + REXML::Formatters::Pretty.new( indent, ie_hack ) + end + else + REXML::Formatters::Default.new( ie_hack ) + end + formatter.write( self, output ) + end + end +end diff --git a/lib/httparty/exceptions.rb b/lib/httparty/exceptions.rb index 15822e1..423f989 100644 --- a/lib/httparty/exceptions.rb +++ b/lib/httparty/exceptions.rb @@ -1,4 +1,7 @@ module HTTParty + # Exception raised when you attempt to set a non-existant format class UnsupportedFormat < StandardError; end + + # Exception that is raised when request has redirected too many times class RedirectionTooDeep < StandardError; end end \ No newline at end of file