Skip to content

Instantly share code, notes, and snippets.

@joeyates
Created January 29, 2017 19:23
Show Gist options
  • Select an option

  • Save joeyates/2d017ae41077c0f14588e159d9a3eec5 to your computer and use it in GitHub Desktop.

Select an option

Save joeyates/2d017ae41077c0f14588e159d9a3eec5 to your computer and use it in GitHub Desktop.
Make HTTP Calls with Non-standard Verbs (in Ruby)
# HTTP
require "net/http"
Net::HTTP.start(host) do |http|
response = http.send_request("FOO", "/", nil, nil)
puts response.body
end
# HTTPS
require "net/https"
Net::HTTP.start(host, use_ssl: true) do |http|
response = http.send_request("FOO", "/", nil, nil)
puts response.body
end
# If the SSL-cert uses an unrecorgized Certificate Authority
Net::HTTP.start(host, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
response = http.send_request("FOO", "/", nil, nil)
puts response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment