Created
January 29, 2017 19:23
-
-
Save joeyates/2d017ae41077c0f14588e159d9a3eec5 to your computer and use it in GitHub Desktop.
Make HTTP Calls with Non-standard Verbs (in Ruby)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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