response

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	UniqueIdentifier string                    // Internally generated UUID for the request
	URL              string                    // URL of the request
	Method           string                    // HTTP method of the request
	RequestPayload   any                       // Payload of the request
	Options          *options.Option           // Additional options for the request
	RequestTime      int64                     // The time when the request was made
	ResponseTime     int64                     // The time when the response was received
	ProcessedTime    int64                     // The time taken for the request to be processed
	Status           string                    // Status of the HTTP response
	StatusCode       int                       // HTTP status code of the response
	Proto            string                    // HTTP protocol used
	Header           http.Header               // HTTP headers of the response
	ContentLength    int64                     // Content length from the response
	TransferEncoding []string                  // Transfer encoding of the response
	CompressionType  options.CompressionType   // Type of compression
	Uncompressed     bool                      // Was the response compressed - https://pkg.go.dev/net/http#Response.Uncompressed
	Cookies          []*http.Cookie            // Cookies received in the response
	AccessTime       time.Duration             // Time taken to complete the request
	Body             options.WriteCloserBuffer // Response body as bytes
	Error            error                     // Error encountered during the request
	TLS              *tls.ConnectionState      // TLS connection state
	Redirected       bool                      // Was the request redirected
	Location         string                    // If redirected, what was the location
}

Response represents the HTTP response along with additional details.

func New added in v0.4.1

func New(url string, method string, payload any, opt *options.Option) Response

func (*Response) Bytes

func (r *Response) Bytes() []byte

Bytes is a helper function to get the underlying bytes.Buffer []byte

func (*Response) Length added in v0.4.0

func (r *Response) Length() int64

func (*Response) PopulateResponse added in v1.0.0

func (r *Response) PopulateResponse(resp *http.Response, start time.Time)

func (*Response) String

func (r *Response) String() string

String is a helper function to get the underlying bytes.Buffer string

Jump to

Keyboard shortcuts

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