Skip to content

Instantly share code, notes, and snippets.

@MelloHey
MelloHey / post.rb
Created December 14, 2018 10:49
curl to ruby
curl -X POST https://mydomain.com/attachments -H 'authorization: Got this’ -F "readme=@README.md"
----------------------------------------------------------------------------------------------------------------
uri = URI.parse("https://mydomain.com/attachments")
request = Net::HTTP::Post.new(uri)
req_headers
request["Authorization"] = req_headers
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|