下拉刷新
Repository Details
Shared bynavbar_avatar
repo_avatar
HelloGitHub Rating
0 ratings
用于 Ruby 的简单 HTTP 客户端
FreeMIT
Claim
Collect
Share
5.2k
Stars
No
Chinese
Ruby
Language
No
Active
91
Contributors
142
Issues
Yes
Organization
None
Latest
931
Forks
MIT
License
More
一个 Ruby 的 HTTP 客户端库。已经有累计 10 万人在使用,该库使用方便、API 设计优雅、支持常用的 HTTP 方法、文件下载、设置代理等。每个方法基本都有示例代码: ```ruby require 'rest_client' RestClient.get 'http://example.com/resource' RestClient.get 'http://example.com/resource', {:params => {:id => 50, 'foo' => 'bar'}} RestClient.get 'https://user:password@example.com/private/resource', {:accept => :json} RestClient.post 'http://example.com/resource', :param1 => 'one', :nested => { :param2 => 'two' } RestClient.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type => :json, :accept => :json RestClient.delete 'http://example.com/resource' response = RestClient.get 'http://example.com/resource' response.code ➔ 200 response.cookies ➔ {"Foo"=>"BAR", "QUUX"=>"QUUUUX"} response.headers ➔ {:content_type=>"text/html; charset=utf-8", :cache_control=>"private" ... response.to_str ➔ \n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n \"http://www.w3.org/TR/html4/strict.dtd\">\n\n<html .... RestClient.post( url, { :transfer => { :path => '/foo/bar', :owner => 'that_guy', :group => 'those_guys' }, :upload => { :file => File.new(path, 'rb') } }) ```
Included in:
Vol.41
Tags:
Ruby
HTTP Client

Comments

Rating:
No comments yet