<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,9 @@
+== 0.1.3 2008-08-XX
+
+* 1 major enhancement:
+	* Added : http_proxy key for setting proxy server and port
+	* Added : raises exception when http error occurs
+
 == 0.1.2 2008-08-09
 
 * 1 major enhancement:</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name = %q{httparty}
-  s.version = &quot;0.1.2&quot;
+  s.version = &quot;0.1.3&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;John Nunemaker&quot;]</diff>
      <filename>httparty.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -21,6 +21,18 @@ module HTTParty
   AllowedFormats = %w[xml json]
   
   module ClassMethods    
+    #
+    # Set an http proxy
+    #
+    #	class Twitter
+    #	  include HTTParty
+    #	  http_proxy http://myProxy, 1080
+    # ....
+    def http_proxy(addr=nil, port = nil)
+	   @http_proxyaddr = addr
+	   @http_proxyport = port
+    end
+
     def base_uri(base_uri=nil)
       return @base_uri unless base_uri
       # don't want this to ever end with /
@@ -80,7 +92,7 @@ module HTTParty
     private
       def http(uri) #:nodoc:
         if @http.blank?
-          @http = Net::HTTP.new(uri.host, uri.port)
+          @http = Net::HTTP.new(uri.host, uri.port, @http_proxyaddr, @http_proxyport)
           @http.use_ssl = (uri.port == 443)
           # so we can avoid ssl warnings
           @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -94,6 +106,7 @@ module HTTParty
       #   body        =&gt; hash of keys/values or a query string (foo=bar&amp;baz=poo)
       #   headers     =&gt; hash of headers to send request with
       #   basic_auth  =&gt; :username and :password to use as basic http authentication (overrides @auth class instance variable)
+      # Raises exception Net::XXX (http error code) if an http error occured
       def send_request(method, path, options={}) #:nodoc:
         raise ArgumentError, 'only get, post, put and delete methods are supported' unless %w[get post put delete].include?(method.to_s)
         raise ArgumentError, ':headers must be a hash' if options[:headers] &amp;&amp; !options[:headers].is_a?(Hash)
@@ -116,7 +129,16 @@ module HTTParty
         # note to self: self, do not put basic auth above headers because it removes basic auth
         request.basic_auth(basic_auth[:username], basic_auth[:password]) if basic_auth
         response       = http(uri).request(request)
-        parse_response(response.body)
+
+        case response
+        when Net::HTTPSuccess     then
+          parse_response(response.body)
+        else
+          response.instance_eval { class &lt;&lt; self; attr_accessor :body_parsed; end }
+          begin; response.body_parsed = parse_response(response.body); rescue; end
+          response.error! # raises  exception corresponding to http error Net::XXX
+        end
+
       end
       
       def parse_response(body) #:nodoc:</diff>
      <filename>lib/httparty.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module HTTParty
   module VERSION #:nodoc:
     MAJOR = 0
     MINOR = 1
-    TINY  = 2
+    TINY  = 3
 
     STRING = [MAJOR, MINOR, TINY].join('.')
   end</diff>
      <filename>lib/httparty/version.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e9003555f044685832a84d013f77a79485445c17</id>
    </parent>
  </parents>
  <author>
    <name>Franck ROUDET</name>
    <email>francxk@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/httparty/commit/b0f1cc2a8d6ab02f2fc7485ad3c25b87319443e4</url>
  <id>b0f1cc2a8d6ab02f2fc7485ad3c25b87319443e4</id>
  <committed-date>2008-08-22T13:32:42-07:00</committed-date>
  <authored-date>2008-08-18T12:48:54-07:00</authored-date>
  <message>Raises exception when http error occurs. Added http_proxy key for setting proxy server and port. [#3 state:resolved] [#7 state:resolved]</message>
  <tree>3f2fb955dfb2d8fa9cb82c2fabeaa7d1fb66b127</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
