request

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateParse = errors.New("failed to parse template")

Functions

This section is empty.

Types

type Auth added in v0.4.0

type Auth interface {
	Apply(r *http.Request)
	GetType() AuthType
}

func NewAuth added in v0.4.0

func NewAuth(t *Template) (Auth, error)

type AuthBase added in v0.4.0

type AuthBase struct {
	Type AuthType `json:"type" yaml:"type"`
}

type AuthType added in v0.4.0

type AuthType string
const (
	Basic  AuthType = "basic"
	Bearer AuthType = "bearer"
)

type BasicAuth added in v0.4.0

type BasicAuth struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

func NewBasicAuth added in v0.4.0

func NewBasicAuth(t *Template) (*BasicAuth, error)

func (*BasicAuth) Apply added in v0.4.0

func (a *BasicAuth) Apply(r *http.Request)

func (*BasicAuth) GetType added in v0.4.0

func (a *BasicAuth) GetType() AuthType

type BearerAuth added in v0.4.0

type BearerAuth struct {
	Token string `json:"token"`
}

func NewBearerAuth added in v0.4.0

func NewBearerAuth(t *Template) (*BearerAuth, error)

func (*BearerAuth) Apply added in v0.4.0

func (a *BearerAuth) Apply(r *http.Request)

func (*BearerAuth) GetType added in v0.4.0

func (a *BearerAuth) GetType() AuthType

type ByteBody added in v0.3.2

type ByteBody []byte

func (*ByteBody) UnmarshalJSON added in v0.3.2

func (b *ByteBody) UnmarshalJSON(data []byte) error

func (*ByteBody) UnmarshalYAML added in v0.3.2

func (b *ByteBody) UnmarshalYAML(value *yaml.Node) error

type Request

type Request struct {
	Method  string
	Path    string
	Body    []byte
	Headers map[string]StringOrStringList
}

func LoadRequest

func LoadRequest(itemPath string) (*Request, error)

func NewRequest added in v0.2.6

func NewRequest(data RequestData) Request

func (*Request) ToHttpRequest added in v0.3.2

func (r *Request) ToHttpRequest() (*http.Request, error)

type RequestData added in v0.2.6

type RequestData struct {
	Method  string                        `json:"method" yaml:"method"`
	Path    string                        `json:"path" yaml:"path"`
	Body    ByteBody                      `json:"body" yaml:"body"`
	Headers map[string]StringOrStringList `json:"headers" yaml:"headers"`
}

type StringOrStringList added in v0.4.0

type StringOrStringList []string

func (*StringOrStringList) UnmarshalJSON added in v0.4.0

func (s *StringOrStringList) UnmarshalJSON(data []byte) error

func (*StringOrStringList) UnmarshalYAML added in v0.4.0

func (s *StringOrStringList) UnmarshalYAML(value *yaml.Node) error

type Template added in v0.4.0

type Template string

func NewTemplate added in v0.4.0

func NewTemplate(templatePath string) (*Template, error)

func (*Template) Interpolate added in v0.4.0

func (t *Template) Interpolate(vars map[string]string, useEnv bool) *Template

func (*Template) Parse added in v0.4.0

func (t *Template) Parse() (*Request, error)

Jump to

Keyboard shortcuts

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