Method: Docker::Connection#request

Defined in:
lib/docker/connection.rb

#request(*args, &block) ⇒ Object

Send a request to the server with the ‘



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/docker/connection.rb', line 35

def request(*args, &block)
  request = compile_request_params(*args, &block)
  if Docker.logger
    Docker.logger.debug(
      [request[:method], request[:path], request[:query], request[:body]]
    )
  end
  resource.request(request).body
rescue Excon::Errors::BadRequest => ex
  raise ClientError, ex.message
rescue Excon::Errors::Unauthorized => ex
  raise UnauthorizedError, ex.message
rescue Excon::Errors::NotFound => ex
  raise NotFoundError, ex.message
rescue Excon::Errors::InternalServerError => ex
  raise ServerError, ex.message
rescue Excon::Errors::Timeout => ex
  raise TimeoutError, ex.message
end