docker: github.com/docker/docker/testutil/request Index | Files

package request

import "github.com/docker/docker/testutil/request"

Index

Package Files

npipe.go ops.go request.go

func ContentType Uses

func ContentType(contentType string) func(*Options)

ContentType sets the specified Content-Type request header

func DaemonHost Uses

func DaemonHost() string

DaemonHost return the daemon host string for this test execution

func DaemonTime Uses

func DaemonTime(ctx context.Context, t testing.TB, client client.APIClient, testEnv *environment.Execution) time.Time

DaemonTime provides the current time on the daemon host

func DaemonUnixTime Uses

func DaemonUnixTime(ctx context.Context, t testing.TB, client client.APIClient, testEnv *environment.Execution) string

DaemonUnixTime returns the current time on the daemon host with nanoseconds precision. It return the time formatted how the client sends timestamps to the server.

func Delete Uses

func Delete(endpoint string, modifiers ...func(*Options)) (*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 Uses

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

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

func Get Uses

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

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

func Head(endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)

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

func Host Uses

func Host(host string) func(*Options)

Host creates a modifier that sets the specified host as the request URL host

func JSON Uses

func JSON(o *Options)

JSON sets the Content-Type request header to json

func JSONBody Uses

func JSONBody(data interface{}) func(*Options)

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 Uses

func Method(method string) func(*Options)

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

func NewAPIClient Uses

func NewAPIClient(t testing.TB, ops ...client.Opt) client.APIClient

NewAPIClient returns a docker API client configured from environment variables

func Post Uses

func Post(endpoint string, modifiers ...func(*Options)) (*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 Uses

func RawContent(reader io.ReadCloser) func(*Options)

RawContent sets the specified reader as body for the request

func RawString Uses

func RawString(content string) func(*Options)

RawString sets the specified string as body for the request

func ReadBody Uses

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

ReadBody read the specified ReadCloser content and returns it

func SockConn Uses

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

SockConn opens a connection on the specified socket

func With Uses

func With(f func(*http.Request) error) func(*Options)

With adds a request modifier to the options

type Options Uses

type Options struct {
    // contains filtered or unexported fields
}

Options defines request options, like request modifiers and which host to target

Package request imports 23 packages (graph) and is imported by 2 packages. Updated 2020-03-13. Refresh now. Tools for package owners.