http

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MethodGET  = "GET"
	MethodPOST = "POST"
)
View Source
const (
	DefaultUserAgent = "Configurator/2.15 (Macintosh; OS X 11.0.0; 16G29) AppleWebKit/2603.3.8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddHeaderTransport

type AddHeaderTransport struct {
	T http.RoundTripper
}

func (*AddHeaderTransport) RoundTrip

func (t *AddHeaderTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Args

type Args struct {
	CookieJar CookieJar
}

type Client

type Client[R interface{}] interface {
	Send(request Request) (Result[R], error)
	Do(req *http.Request) (*http.Response, error)
	NewRequest(method, url string, body io.Reader) (*http.Request, error)
}

func NewClient

func NewClient[R interface{}](args Args) Client[R]

type CookieJar

type CookieJar interface {
	http.CookieJar

	Save() error
}

type Payload

type Payload interface {
	// contains filtered or unexported methods
}

type Request

type Request struct {
	Method         string
	URL            string
	Headers        map[string]string
	Payload        Payload
	ResponseFormat ResponseFormat
}

type ResponseFormat

type ResponseFormat string
const (
	ResponseFormatJSON ResponseFormat = "json"
	ResponseFormatXML  ResponseFormat = "xml"
)

type Result

type Result[R interface{}] struct {
	StatusCode int
	Headers    map[string]string
	Data       R
}

type URLPayload

type URLPayload struct {
	Content map[string]interface{}
}

type XMLPayload

type XMLPayload struct {
	Content map[string]interface{}
}

Jump to

Keyboard shortcuts

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