Created
January 23, 2014 12:11
-
-
Save TvL2386/8577594 to your computer and use it in GitHub Desktop.
example json put request with optional SSL
This file contains 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
require 'net/https' | |
require 'json' | |
host = 'localhost' | |
port = 3000 | |
path = '/controller/upload.json?key=bla' | |
json = {}.to_json | |
http = Net::HTTP.new host, port | |
#http.use_ssl = true | |
#http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
response = http.request_put(path, json, 'Content-Type' => 'application/json') | |
puts response.code | |
require 'awesome_print' | |
ap JSON.parse(response.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment