Skip to content
Browse files

Add Upgrade guide.

  • Loading branch information...
1 parent 4489be6 commit 62361876ff6431be77d4168e07d44a89287f7b54 @i0rek i0rek committed
Showing with 45 additions and 0 deletions.
  1. +45 −0 UPGRADE.md
View
45 UPGRADE.md
@@ -0,0 +1,45 @@
+# Upgrade guide
+
+## To 0.5
+
+1. Fix the option names, because some were renamed. The errors should point you in the right direction:
+
+```ruby
+Typhoeus.get("www.example.com", follow_location: true)
+# Ethon::Errors::InvalidOption: The option: follow_location is invalid.
+# Please try followlocation instead of follow_location.
+# ... [Backtrace]
+
+Typhoeus.get("www.example.com", followlocation: true).code
+#=> 200
+```
+
+2. `Response#headers` returns a hash now and replaces `Reponse#headers_hash, use `Response#response_headers` for the raw string:
+
+```ruby
+Typhoeus.get("www.example.com", followlocation: true).headers
+#=> {
+# "date"=>"Tue, 06 Nov 2012 09:07:27 GMT",
+# "server"=>"Apache/2.2.3 (CentOS)",
+# "last-modified"=>"Wed, 09 Feb 2011 17:13:15 GMT",
+# "vary"=>"Accept-Encoding",
+# "connection"=>"close",
+# "content-type"=>"text/html; charset=UTF-8"
+# }
+
+Typhoeus.get("www.example.com", followlocation: true).response_headers
+#=> "HTTP/1.0 302 Found\r\nLocation: http://www.iana.org/domains/example/ [...]"
+```
+
+3. Make sure every request sends proper params and body (especially POST/PUT). `:params` becomes url parameter and `:body` request body. Before params for POST was smashed into the body.
+
+4. Create a global configuration in case you want to turn on verbose, memoize or block_connection:
+
+```ruby
+Typhoeus.configure do |config|
+ config.verbose = true
+ config.memoize = true
+end
+```
+
+5. When in doubt read the [docs](http://rubydoc.info/github/typhoeus/typhoeus/frames/Typhoeus) or the [code](https://www.github.com/typhoeus).

0 comments on commit 6236187

Please sign in to comment.
Something went wrong with that request. Please try again.