Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedBodyType = errors.New("unsupported body type")
Functions ¶
This section is empty.
Types ¶
type FileField ¶
type FileField struct {
// Fieldname is the name of the field
Fieldname string
// Filename is the name of the file
Filename string
// Source is the path to the file
Source string
// Body is the content of the file
Body any
}
FileField represents a file field data for one file
type Request ¶
type Request struct {
// Ctx is the context of the request
Ctx context.Context
// Method is the HTTP method. Default is GET
Method string
// Header is the HTTP headers
Header http.Header
// Body is the raw request body
Body []byte
// Form is the form data that will be encoded as application/x-www-form-urlencoded
Form url.Values
// Params is the query parameters
Params url.Values
// Files represents the files that will be sent in the request's body as multipart/form-data
Files []*FileField
// Cookies is the cookies that will be sent in the request
Cookies []*http.Cookie
// URL is the URL of the request
URL *url.URL
// Trace is a flag that indicates if the request should be traced
Trace bool
// JSON is a entity to be sent as JSON
JSON any
// contains filtered or unexported fields
}
Request represents a wrapper around http.Request
func NewRequest ¶
func NewRequest(ctx context.Context, dstURL string, opts ...RequestOption) *Request
NewRequest creates a new wrapped request with options
func (*Request) IntoHttpRequest ¶
IntoHttpRequest converts the request to http.Request
type RequestOption ¶
type RequestOption func(*Request)
RequestOption is a function that modifies the request
type TLSHandshake ¶
type TLSHandshake struct {
State tls.ConnectionState
Error error
}
TLSHandshake represents a TLS handshake
type TraceConnect ¶
TraceConnect represents a connection trace
type TraceInfo ¶
type TraceInfo struct {
Timings TraceTimings
GetConnHost string
GotConn httptrace.GotConnInfo
DNSDone httptrace.DNSDoneInfo
DNSStart httptrace.DNSStartInfo
WroteRequest httptrace.WroteRequestInfo
PutIdleError error
ConnectStart []TraceConnect
ConnectDone []TraceConnect
}
TraceInfo represents the trace information
type TraceTimings ¶
type TraceTimings struct {
ConnGet time.Time
ConnGot time.Time
PutIdleConn time.Time
DNSStart time.Time
DNSDone time.Time
ConnectStart time.Time
ConnectDone time.Time
TLSHandshakeStart time.Time
TLSHandshakeDone time.Time
FirstByte time.Time
Wait100Continue time.Time
WroteHeaders time.Time
WroteRequest time.Time
}
TraceTimings represents the timings of the request
Click to show internal directories.
Click to hide internal directories.