http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Url             *template.UrlTemplate         `yaml:"url"`
	Method          HttpMethod                    `yaml:"method"`
	Body            *template.Template            `yaml:"body"`
	Headers         map[string]*template.Template `yaml:"headers"`
	ResponseChecker *responseChecker              `yaml:"responses"`
	Follow          bool                          `default:"true" yaml:"followRedirects"`
	Transport       *http.Transport               `yaml:"transport"`
	// contains filtered or unexported fields
}

func (*Client) MakeRequest

func (s *Client) MakeRequest(ctx context.Context, req *http.Request) (*Response, error)

func (*Client) NewRequest

func (s *Client) NewRequest(data any) (*http.Request, error)

func (*Client) UnmarshalYAML

func (s *Client) UnmarshalYAML(unmarshal func(interface{}) error) error

type HttpMethod

type HttpMethod string

func (HttpMethod) String

func (hm HttpMethod) String() string

func (*HttpMethod) UnmarshalYAML

func (hm *HttpMethod) UnmarshalYAML(unmarshal func(interface{}) error) error

type RequestResult

type RequestResult string
const (
	Success RequestResult = "success"
	Error   RequestResult = "error"
	Fatal   RequestResult = "fatal"
)

func RequestResultFromError

func RequestResultFromError(err error) (RequestResult, bool)

func (RequestResult) String

func (rt RequestResult) String() string

func (RequestResult) ToError

func (rt RequestResult) ToError() error

func (*RequestResult) UnmarshalYAML

func (rt *RequestResult) UnmarshalYAML(unmarshal func(interface{}) error) error

type Response

type Response struct {
	StatusCode int
	Body       string
	Json       any `json:"-"`
}

Jump to

Keyboard shortcuts

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