package request
import "github.com/docker/docker/testutil/request"
Index ¶
- func ContentType(contentType string) func(*Options)
- func DaemonHost() string
- func DaemonTime(ctx context.Context, t testing.TB, client client.APIClient, testEnv *environment.Execution) time.Time
- func DaemonUnixTime(ctx context.Context, t testing.TB, client client.APIClient, testEnv *environment.Execution) string
- func Delete(ctx context.Context, endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)
- func Do(ctx context.Context, endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)
- func Get(ctx context.Context, endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)
- func Head(ctx context.Context, endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)
- func Host(host string) func(*Options)
- func JSON(o *Options)
- func JSONBody(data interface{}) func(*Options)
- func Method(method string) func(*Options)
- func NewAPIClient(t testing.TB, ops ...client.Opt) client.APIClient
- func Post(ctx context.Context, endpoint string, modifiers ...func(*Options)) (*http.Response, io.ReadCloser, error)
- func RawContent(reader io.ReadCloser) func(*Options)
- func RawString(content string) func(*Options)
- func ReadBody(b io.ReadCloser) ([]byte, error)
- func SockConn(timeout time.Duration, daemon string) (net.Conn, error)
- func With(f func(*http.Request) error) func(*Options)
- type Options
Functions ¶
func ContentType ¶
ContentType sets the specified Content-Type request header
func DaemonHost ¶
func DaemonHost() string
DaemonHost return the daemon host string for this test execution
func DaemonTime ¶
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 ¶
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 ¶
func Delete(ctx context.Context, 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 ¶
func Do(ctx context.Context, 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 ¶
func Get(ctx context.Context, 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 ¶
func Head(ctx context.Context, 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 ¶
Host creates a modifier that sets the specified host as the request URL host
func JSON ¶
func JSON(o *Options)
JSON sets the Content-Type request header to json
func JSONBody ¶
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 ¶
Method creates a modifier that sets the specified string as the request method
func NewAPIClient ¶
NewAPIClient returns a docker API client configured from environment variables
func Post ¶
func Post(ctx context.Context, 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 ¶
func RawContent(reader io.ReadCloser) func(*Options)
RawContent sets the specified reader as body for the request
func RawString ¶
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 ¶
SockConn opens a connection on the specified socket
func With ¶
With adds a request modifier to the options
Types ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options defines request options, like request modifiers and which host to target
Source Files ¶
- Version
- v27.0.0-rc.2+incompatible
- Published
- Jun 17, 2024
- Platform
- js/wasm
- Imports
- 22 packages
- Last checked
- 3 seconds ago –
Tools for package owners.