Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

HTTP Client example

  • http/client
  • HTTP::Client
require "http/client"

url = "https://httpbin.org/get"
response = HTTP::Client.get(url)
puts response.status_code
puts response.body

# Setting some values in the header
url = "https://httpbin.org/get"
response = HTTP::Client.get(url, headers: HTTP::Headers{"Key" => "Value"})
puts response.status_code
puts response.body