types

package
v3.2.11 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpRequest

type HttpRequest struct {
	// method of the request
	Method string `json:"method"`
	// headers of the request
	Headers mapsutil.OrderedMap[string, string] `json:"headers"`
	// body of the request
	Body string `json:"body"`
	// raw request (includes everything including method, headers, body, etc)
	Raw string `json:"raw"`
}

HttpRequest is a struct containing the http request

func (*HttpRequest) Clone

func (hr *HttpRequest) Clone() *HttpRequest

Clone clones the request

func (*HttpRequest) ID

func (hr *HttpRequest) ID() string

ID returns a unique id/hash for raw request

type HttpResponse

type HttpResponse struct {
	// status code of the response
	StatusCode int `json:"status_code"`
	// headers of the response
	Headers mapsutil.OrderedMap[string, string] `json:"headers"`
	// body of the response
	Body string `json:"body"`
	// raw response (includes everything including status code, headers, body, etc)
	Raw string `json:"raw"`
}

func (*HttpResponse) Clone

func (hr *HttpResponse) Clone() *HttpResponse

Clone clones the response

func (*HttpResponse) ID

func (hr *HttpResponse) ID() string

Id returns a unique id/hash for raw response

type InputLivenessProbe

type InputLivenessProbe interface {
	// ProbeURL probes the scheme for a URL. first HTTPS is tried
	ProbeURL(input string) (string, error)
	// Close closes the liveness probe
	Close() error
}

InputLivenessProbe is an interface for probing the liveness of an input

type RequestResponse

type RequestResponse struct {
	// Timestamp is the timestamp of the request
	// Timestamp string `json:"timestamp"`
	// URL is the URL of the request
	URL urlutil.URL `json:"url"`
	// Request is the request of the request
	Request *HttpRequest `json:"request"`
	// Response is the response of the request
	Response *HttpResponse `json:"response"`
	// contains filtered or unexported fields
}

RequestResponse is a struct containing request and response obtained from one of the input formats. this struct can be considered as pd standard for request and response

func ParseRawRequest

func ParseRawRequest(raw string) (rr *RequestResponse, err error)

ParseRawRequest parses a raw request from a string and returns the request and response object Note: it currently does not parse response and is meant to be added manually since its a optional field

func ParseRawRequestWithURL

func ParseRawRequestWithURL(raw, url string) (rr *RequestResponse, err error)

ParseRawRequestWithURL parses a raw request from a string with given url

func (*RequestResponse) BuildRequest

func (rr *RequestResponse) BuildRequest() (*retryablehttp.Request, error)

BuildRequest builds a retryablehttp request from the request response

func (*RequestResponse) Clone

func (rr *RequestResponse) Clone() *RequestResponse

Clone clones the request response

func (*RequestResponse) ID

func (rr *RequestResponse) ID() string

ID returns a unique id/hash for request response

func (*RequestResponse) MarshalJSON

func (rr *RequestResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the request response to json

func (*RequestResponse) UnmarshalJSON

func (rr *RequestResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the request response from json

Jump to

Keyboard shortcuts

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