hand

package
v0.0.0-...-0e469d2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHttpOptions = HttpOptions{
	Method: "GET",
	Url:    "",
	Headers: settings.KeyValueMap{
		"Accept": {
			Value: "*/*",
		},
	},
	Params: make(settings.KeyValueMap),

	Settings: HttpSettings{
		SSLVerification:  true,
		FollowRedirects:  false,
		URLEncode:        true,
		MinifyBody:       true,
		DisableCookieJar: false,
		MaxRedirects:     3,
		Proxy:            "",
		Timeout:          5,
	},
}

Functions

This section is empty.

Types

type Hand

type Hand interface {
	Validate(interface{}) error
	Run(interface{}) (interface{}, error)
	GetExports() map[string]interface{}
}

type HttpHand

type HttpHand struct{}

func (*HttpHand) GetExports

func (h *HttpHand) GetExports() map[string]interface{}

func (*HttpHand) Run

func (h *HttpHand) Run(options *HttpOptions) (*http.Response, error)

func (*HttpHand) Validate

func (h *HttpHand) Validate(options *HttpOptions) error

type HttpOptions

type HttpOptions struct {
	Method  string               `json:"method" title:"HTTP method"`
	Url     string               `json:"url" title:"Request URL"`
	Headers settings.KeyValueMap `json:"headers,omitempty" yaml:"headers,omitempty" title:"Request headers"`
	Params  settings.KeyValueMap `json:"params,omitempty" yaml:"params,omitempty" title:"Request parameters"`
	Body    *body.BodyBase       `json:"body,omitempty" yaml:"body,omitempty" title:"Request body"`

	Settings HttpSettings `json:"settings"`
	// contains filtered or unexported fields
}

func NewHttpOptions

func NewHttpOptions() *HttpOptions

type HttpRequest

type HttpRequest struct {
	*HttpOptions
}

func NewHttpRequest

func NewHttpRequest(method, url string) *HttpRequest

func (*HttpRequest) Fire

func (r *HttpRequest) Fire() map[string]interface{}

func (*HttpRequest) MethodsMap

func (r *HttpRequest) MethodsMap() map[string]interface{}

func (*HttpRequest) Multipart

func (r *HttpRequest) Multipart() map[string]interface{}

func (*HttpRequest) UrlEncoded

func (r *HttpRequest) UrlEncoded() map[string]interface{}

type HttpResponse

type HttpResponse struct {
	*http.Response

	Headers settings.KeyValueMap
	// contains filtered or unexported fields
}

func NewHttpResponse

func NewHttpResponse(resp *http.Response) *HttpResponse

func (*HttpResponse) MethodsMap

func (r *HttpResponse) MethodsMap() map[string]interface{}

type HttpSettings

type HttpSettings struct {
	SSLVerification  bool   `json:"ssl_verification" title:"SSL certificate verification"`
	FollowRedirects  bool   `json:"follow_redirects" title:"Follow redirects"`
	URLEncode        bool   `json:"url_encode" title:"Url encoding of path and query parameters"`
	MinifyBody       bool   `json:"minify_body" title:"Minification of body (json, xml, etc.)"`
	DisableCookieJar bool   `json:"disable_cookie_jar" title:"Prevent using common cookie jar for request"`
	MaxRedirects     int    `json:"max_redirects" title:"Maximum number of redirects"`
	Proxy            string `json:"proxy" title:"Proxy server URL"`
	Timeout          int    `json:"timeout" title:"Timeout in seconds (0 - forever)"`
}

func (*HttpSettings) Get

func (s *HttpSettings) Get(key string) any

func (*HttpSettings) MethodsMap

func (s *HttpSettings) MethodsMap() map[string]interface{}

func (*HttpSettings) Set

func (s *HttpSettings) Set(key string, value any)

Jump to

Keyboard shortcuts

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