request

package
v1.4.2-0...-b00b1b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentType

func ContentType(contentType string) func(*http.Request) error

ContentType sets the specified Content-Type request header

func DaemonHost

func DaemonHost() string

DaemonHost return the daemon host string for this test execution

func Delete

func Delete(endpoint string, modifiers ...func(*http.Request) error) (*http.Response, io.ReadCloser, error)

Delete creates and execute a DELETE request on the specified host and endpoint, with the specified request modifiers

func Do

func Do(endpoint string, modifiers ...func(*http.Request) error) (*http.Response, io.ReadCloser, error)

Do creates and execute a request on the specified endpoint, with the specified request modifiers

func DoOnHost

func DoOnHost(host, endpoint string, modifiers ...func(*http.Request) error) (*http.Response, io.ReadCloser, error)

DoOnHost creates and execute a request on the specified host and endpoint, with the specified request modifiers

func Get

func Get(endpoint string, modifiers ...func(*http.Request) error) (*http.Response, io.ReadCloser, error)

Get creates and execute a GET request on the specified host and endpoint, with the specified request modifiers

func JSON

func JSON(req *http.Request) error

JSON sets the Content-Type request header to json

func JSONBody

func JSONBody(data interface{}) func(*http.Request) error

JSONBody creates a modifier that encodes the specified data to a JSON string and set it as request body. It also sets the Content-Type header of the request.

func Method

func Method(method string) func(*http.Request) error

Method creates a modifier that sets the specified string as the request method

func New

func New(host, endpoint string, modifiers ...func(*http.Request) error) (*http.Request, error)

New creates a new http Request to the specified host and endpoint, with the specified request modifiers

func NewClient

func NewClient() (dclient.APIClient, error)

NewClient returns a new Docker API client

func NewClientForHost

func NewClientForHost(host string) (dclient.APIClient, error)

NewClientForHost returns a Docker API client for the host

func NewEnvClientWithVersion

func NewEnvClientWithVersion(version string) (*dclient.Client, error)

NewEnvClientWithVersion returns a docker client with a specified version. See: github.com/docker/docker/client `NewEnvClient()`

func NewHTTPClient

func NewHTTPClient(host string) (*http.Client, error)

NewHTTPClient creates an http client for the specific host

func Post

func Post(endpoint string, modifiers ...func(*http.Request) error) (*http.Response, io.ReadCloser, error)

Post creates and execute a POST request on the specified host and endpoint, with the specified request modifiers

func RawContent

func RawContent(reader io.ReadCloser) func(*http.Request) error

RawContent sets the specified reader as body for the request

func RawString

func RawString(content string) func(*http.Request) error

RawString sets the specified string as body for the request

func ReadBody

func ReadBody(b io.ReadCloser) ([]byte, error)

ReadBody read the specified ReadCloser content and returns it

func SockConn

func SockConn(timeout time.Duration, daemon string) (net.Conn, error)

SockConn opens a connection on the specified socket

func SockRequest

func SockRequest(method, endpoint string, data interface{}, daemon string, modifiers ...func(*http.Request)) (int, []byte, error)

SockRequest create a request against the specified host (with method, endpoint and other request modifier) and returns the status code, and the content as an byte slice Deprecated: use request.Do instead

func SockRequestHijack

func SockRequestHijack(method, endpoint string, data io.Reader, ct string, daemon string, modifiers ...func(*http.Request)) (net.Conn, *bufio.Reader, error)

SockRequestHijack creates a connection to specified host (with method, contenttype, …) and returns a hijacked connection and the output as a `bufio.Reader`

func SockRequestRaw

func SockRequestRaw(method, endpoint string, data io.Reader, ct, daemon string, modifiers ...func(*http.Request)) (*http.Response, io.ReadCloser, error)

SockRequestRaw create a request against the specified host (with method, endpoint and other request modifier) and returns the http response, the output as a io.ReadCloser Deprecated: use request.Do (or Get, Delete, Post) instead

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL