Skip to content

Instantly share code, notes, and snippets.

@TvL2386
Created January 23, 2014 12:11
Show Gist options
  • Save TvL2386/8577594 to your computer and use it in GitHub Desktop.
Save TvL2386/8577594 to your computer and use it in GitHub Desktop.
example json put request with optional SSL
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