Created
April 29, 2017 15:49
-
-
Save mrtc0/e19c2e309561f6df2ac3e65fbc054137 to your computer and use it in GitHub Desktop.
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_http_unix' | |
require 'json' | |
def sample(url) | |
req = Net::HTTP::Get.new(url) | |
client = NetX::HTTPUnix.new('unix:///var/lib/lxd/unix.socket') | |
resp = client.request(req) | |
puts resp.body | |
end | |
req = Net::HTTP::Post.new("/1.0/containers/admin/files?path=/tmp/test") | |
req.add_field('Content-Type', 'application/octet-stream') | |
req.body = File.read('rblxd.rb') | |
client = NetX::HTTPUnix.new('unix:///var/lib/lxd/unix.socket') | |
resp = client.request(req) | |
j = JSON.parse(resp.body) | |
p j |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment