mock

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientResponse

func ClientResponse(code specs.StatusCode, body io.ReadCloser) plow.ClientResponse

ClientResponse creates a mock client response with the given status code and body.

Types

type RequestBuilder

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

RequestBuilder is used to build a plow.Request with customizable fields.

func DefaultRequest

func DefaultRequest() *RequestBuilder

DefaultRequest creates a new RequestBuilder with default values.

func (*RequestBuilder) Addr

func (b *RequestBuilder) Addr(network, domain string, port int) *RequestBuilder

Addr sets the remote address for the request.

func (*RequestBuilder) Body

func (b *RequestBuilder) Body(body io.ReadCloser) *RequestBuilder

Body sets the body for the request.

func (*RequestBuilder) ConfHeader

func (b *RequestBuilder) ConfHeader(conf func(*specs.Header)) *RequestBuilder

ConfHeader applies a configuration function to the request header. This allows for custom modifications to the header.

func (*RequestBuilder) Header

func (b *RequestBuilder) Header() *specs.Header

Header returns the header for the request. If the header is nil, it initializes a new Header.

func (*RequestBuilder) Hijacker

func (b *RequestBuilder) Hijacker() plow.HijackHandler

Hijacker returns the hijack handler for the request.

func (*RequestBuilder) Method

func (b *RequestBuilder) Method(method specs.HttpMethod) *RequestBuilder

Method sets the HTTP method for the request.

func (*RequestBuilder) Proto

func (b *RequestBuilder) Proto(protoMajor, protoMinor uint16) *RequestBuilder

Proto sets the protocol version for the request.

func (*RequestBuilder) Request

func (b *RequestBuilder) Request() plow.Request

Request returns a plow.Request based on the current state of the RequestBuilder.

func (*RequestBuilder) Url

func (b *RequestBuilder) Url(url *specs.Url) *RequestBuilder

Url sets the URL for the request.

Jump to

Keyboard shortcuts

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