models

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 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 HistoricalHttpRequest

type HistoricalHttpRequest struct {
	Method    string            `json:"method"`
	URL       string            `json:"url"`
	Headers   map[string]string `json:"headers"`
	Body      string            `json:"body,omitempty"`
	StartTime int64             `json:"startTime"`
}

HistoricalHttpRequest represents a saved request in history

func NewHistoricalHttpRequest

func NewHistoricalHttpRequest(req *HttpRequest, startTime int64) *HistoricalHttpRequest

NewHistoricalHttpRequest creates a historical request from an HttpRequest

type HttpRequest

type HttpRequest struct {
	Method         string
	URL            string
	Headers        map[string]string
	Body           io.Reader
	RawBody        string
	Name           string
	IsCancelled    bool
	Metadata       RequestMetadata
	MultipartParts []MultipartPart // For multipart/form-data
}

HttpRequest represents an HTTP request

func NewHttpRequest

func NewHttpRequest(method, url string, headers map[string]string, body io.Reader, rawBody, name string) *HttpRequest

NewHttpRequest creates a new HttpRequest

func (*HttpRequest) ContentType

func (r *HttpRequest) ContentType() string

ContentType returns the content type of the request

func (*HttpRequest) ToStdRequest

func (r *HttpRequest) ToStdRequest() (*http.Request, error)

ToStdRequest converts HttpRequest to standard http.Request

type HttpResponse

type HttpResponse struct {
	StatusCode       int
	StatusMessage    string
	HttpVersion      string
	Headers          map[string][]string
	Body             string
	BodySizeInBytes  int
	HeadersSizeBytes int
	BodyBuffer       []byte
	Timing           ResponseTiming
	Request          *HttpRequest
}

HttpResponse represents an HTTP response

func NewHttpResponse

func NewHttpResponse(resp *http.Response, bodyBuffer []byte, timing ResponseTiming, request *HttpRequest) *HttpResponse

NewHttpResponse creates a new HttpResponse from an http.Response

func (*HttpResponse) ContentType

func (r *HttpResponse) ContentType() string

ContentType returns the content type of the response

func (*HttpResponse) GetHeader

func (r *HttpResponse) GetHeader(name string) string

GetHeader returns a header value (case-insensitive)

func (*HttpResponse) IsHTML

func (r *HttpResponse) IsHTML() bool

IsHTML returns true if the response is HTML

func (*HttpResponse) IsJSON

func (r *HttpResponse) IsJSON() bool

IsJSON returns true if the response is JSON

func (*HttpResponse) IsXML

func (r *HttpResponse) IsXML() bool

IsXML returns true if the response is XML

type MultipartPart

type MultipartPart struct {
	Name        string // Field name
	Value       string // Field value (for text fields)
	FileName    string // Original filename (for file uploads)
	FilePath    string // Local path to the file
	ContentType string // MIME type of the content
	IsFile      bool   // Whether this is a file upload
}

MultipartPart represents a part in a multipart/form-data request

type PromptVariable

type PromptVariable struct {
	Name        string
	Description string
	IsPassword  bool
}

PromptVariable represents a variable that requires user input

type RequestMetadata

type RequestMetadata struct {
	Name        string
	Note        string
	NoRedirect  bool
	NoCookieJar bool
	Prompts     []PromptVariable
	PreScript   string // JavaScript to run before the request
	PostScript  string // JavaScript to run after the response
}

RequestMetadata holds request-level settings

type ResponseTiming

type ResponseTiming struct {
	DNSLookup        time.Duration
	TCPConnection    time.Duration
	TLSHandshake     time.Duration
	ServerProcessing time.Duration
	ContentTransfer  time.Duration
	Total            time.Duration
}

ResponseTiming contains timing information for the response

Jump to

Keyboard shortcuts

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