Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/http'
- uri = URI('http://www.example.com/search.cgi')
- res = Net::HTTP.post_form(uri, 'q' => ['ruby', 'perl'], 'max' => '50')
- puts res.body
- gem "http"
- require 'http'
- response = HTTP.post("https://api.test/post", :params => {:id => 5})
- response.body # retorna um objeto representando a resposta
- response.code # retorna o código HTTP da resposta, e.g. 404, 500, 200
- HTTP.basic_auth(:user => "user", :pass => "pass")
- .get("https://example.com")
- HTTP.auth("Bearer VGhlIEhUVFAgR2VtLCBST0NLUw")
- .get("https://example.com")
Add Comment
Please, Sign In to add comment