Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated for v1.1.10

  • Loading branch information...
commit 35abcfdce25ab66ba4f198c61bdec25541abe04b 1 parent 771141b
Zhou Xianhua authored
View
3  Changelog
@@ -1,3 +1,6 @@
+v1.1.10
+ * make it wroks on Ruby1.9.2
+
v1.1.9
* re-format code with 2 spaces and fixed the version number
View
15 README.rdoc
@@ -27,16 +27,17 @@ include http_request.rb first
or install it "gem install http_request.rb", then require 'http_request'
get
- puts HttpRequest.get('http://www.github.com')
+ puts HttpRequest.get('http://www.github.com').body
get with query string, 4 are same
- puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N')
- puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N')
- puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'})
- puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}})
+ puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N').body
+ puts HttpRequest.get('http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
+ puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
+ puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'}).body
+ puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}}).body
post with some parameters
- puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => 'from=http_request.rb').body
+ puts HttpRequest.get('http://localhost/test.php', :parameters => 'from=http_request.rb').body
puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => {:name => 'Ruby', :time => 'Now'}).body
also support other http methods, such as put, delete, trace, options, move etc.
@@ -227,4 +228,4 @@ download multiple files from a directory
bug fixing, testing and testing...
== LATEST VERSION
- 1.1.9
+ 1.1.10
View
2  http_request.gemspec
@@ -3,7 +3,7 @@ SPEC=Gem::Specification.new do |s|
s.homepage = 'http://github.com/xianhuazhou'
s.rubyforge_project = "http_request.rb"
s.name = 'http_request.rb'
- s.version = '1.1.9'
+ s.version = '1.1.10'
s.author = 'xianhua.zhou'
s.email = 'xianhua.zhou@gmail.com'
s.platform = Gem::Platform::RUBY
View
6 lib/http_request.rb
@@ -11,7 +11,7 @@
#
# == Version
#
-# v1.1.9
+# v1.1.10
#
# Last Change: 13 Sep, 2010
#
@@ -32,7 +32,7 @@ class HttpRequest
include Singleton
class << self
# version
- VERSION = '1.1.9'.freeze
+ VERSION = '1.1.10'.freeze
def version;VERSION;end
# avaiabled http methods
@@ -104,7 +104,7 @@ def self.method_missing(method_name, *options, &block)
end
@@redirect_times = 0
# we need to retrieve the cookies from last http response before reset cookies if it's a Net::HTTPResponse
- options[:cookies] = options[:cookies].cookies if options[:cookies].is_a? Net::HTTPResponse
+ options[:cookies] = options[:cookies].cookies if options.is_a?(Hash) and options[:cookies].is_a?(Net::HTTPResponse)
@@__cookies = {}
method_name = method_name.to_s.downcase
raise NoHttpMethodException, "No such http method can be called: #{method_name}" unless self.http_methods.include?(method_name)
Please sign in to comment.
Something went wrong with that request. Please try again.