Module: Docker::Multipart
Overview
This Mixin provides the ability to do multipart post requests.
Instance Method Summary collapse
-
#multipart_request(path, name, io, connection) ⇒ Object
Given a path, resource name, io, and Connection sends a multipart request.
Instance Method Details
#multipart_request(path, name, io, connection) ⇒ Object
Given a path, resource name, io, and Connection sends a multipart request.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/docker/multipart.rb', line 6 def multipart_request(path, name, io, connection) host, port = host_and_port(connection) res = Net::HTTP.start(host, port) { |http| req = build_multipart_post(path, io, 'application/octet-stream', name) http.request(req) } if (200..204).include?(res.code.to_i) res.body else raise UnexpectedResponseError, "Got status #{res.code}" end end |