lib

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Overview

Taken from https://github.com/golang/go https://github.com/golang/go/blob/master/src/cmd/internal/browser/browser.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands added in v0.10.0

func Commands() [][]string

Commands returns a list of possible commands to use to open a url.

func LoadRepeatCount added in v1.2.0

func LoadRepeatCount(name string, evCtx *EvalContext) (int, error)

func OpenBrowser added in v0.10.0

func OpenBrowser(url string) bool

Open tries to open url in a browser and reports whether it succeeded.

Types

type AllParsedSecrets

type AllParsedSecrets map[string]ParsedSecret

type Assertion added in v0.11.0

type Assertion struct {
	Name string
	Pass bool
	Text string
}

type AssertionFunc added in v0.11.0

type AssertionFunc struct {
	Params []function.Parameter
	Type   function.TypeFunc
	Impl   function.ImplFunc
}

type Assertions added in v0.11.0

type Assertions []Assertion

type AuthCfg

type AuthCfg struct {
	BasicAuth  *BasicAuthCfg  `hcl:"basic,block"`
	BearerAuth *BearerAuthCfg `hcl:"bearer,block"`
}

type BasicAuthCfg

type BasicAuthCfg struct {
	Body hcl.Body `hcl:",remain"`
}

type BearerAuthCfg

type BearerAuthCfg struct {
	Body hcl.Body `hcl:",remain"`
}

type EnvironmentCfg

type EnvironmentCfg struct {
	Name      string     `hcl:"name,label"`
	Default   bool       `hcl:"default,optional"`
	Secrets   SecretCfgs `hcl:"secrets,block"`
	Variables hcl.Body   `hcl:",remain"`
}

type EnvironmentCfgs

type EnvironmentCfgs []*EnvironmentCfg

type EvalContext

type EvalContext struct {
	Functions     *map[string]function.Function
	Variables     *map[string]cty.Value
	Environment   *cty.Value
	RequestAsVars *RequestAsVars
	RawRequests   RequestCfgs
	RawDynamics   VariableCfgs
	RawTests      TestCfgs
}

func LoadEvalCtx

func LoadEvalCtx(env string, execCtx *ExecutionContext) (*EvalContext, error)

LoadEvalCtx Get all internal functions Parse external functions Parse environment variables Parse variables Create EvalContext

type ExecutionContext

type ExecutionContext struct {
	Version string
	Debug   bool
}

type ExternalFunctionCfg

type ExternalFunctionCfg struct {
	Name        string   `hcl:"name,label"`
	Interpreter string   `hcl:"interpreter,attr"`
	Script      string   `hcl:"script,attr"`
	Args        []string `hcl:"args,optional"`
}

type ExternalFunctionCfgs

type ExternalFunctionCfgs []*ExternalFunctionCfg

type GofakeitFunc

type GofakeitFunc struct {
	Params []function.Parameter
	Type   function.TypeFunc
	Impl   function.ImplFunc
}

type Headers added in v1.0.0

type Headers struct {
	// contains filtered or unexported fields
}

func (*Headers) Add added in v1.0.0

func (headers *Headers) Add(k string, v string) *Headers

func (*Headers) AddBulk added in v1.0.0

func (headers *Headers) AddBulk(all map[string]string) *Headers

func (*Headers) FromResponse added in v1.0.0

func (headers *Headers) FromResponse(resHeaders http.Header) *Headers

func (*Headers) Get added in v1.0.0

func (headers *Headers) Get(searchKey string) (found *string)

func (*Headers) GetAll added in v1.0.0

func (headers *Headers) GetAll() map[string][]string

func (*Headers) GetKey added in v1.0.0

func (headers *Headers) GetKey(searchKey string) *string

func (*Headers) OrderedCallBack added in v1.1.0

func (headers *Headers) OrderedCallBack(cb OrderedMapCallback)

func (*Headers) Set added in v1.0.0

func (headers *Headers) Set(k string, v string) *Headers

func (*Headers) SetCookies added in v1.0.0

func (headers *Headers) SetCookies(cookies map[string]string)

func (*Headers) ToRequest added in v1.0.0

func (headers *Headers) ToRequest(httpReq *http.Request)

type ListObject added in v1.0.0

type ListObject struct {
	Name string
	Type string
}

func ListRequestsAndTests added in v1.0.0

func ListRequestsAndTests(lsType string, execCtx *ExecutionContext) (list []ListObject, maxNameLen int, err error)

type OrderedMapCallback added in v1.1.0

type OrderedMapCallback func(k, v string)

type ParamsBlockCfg added in v0.13.0

type ParamsBlockCfg struct {
	Body hcl.Body `hcl:",remain"`
}

type ParsedAssertions added in v0.11.0

type ParsedAssertions map[string]cty.Value

type ParsedSecret

type ParsedSecret map[string]string

type Request

type Request struct {
	Method  string
	Url     string
	FullUrl string
	Headers Headers
	Body    io.Reader
	Params  map[string]string
	EvalContext
	PrecedingRequests []*Response
	*Response
	*ExecutionContext
	RoundTripper http.RoundTripper
}

func LoadOnlyRequest

func LoadOnlyRequest(name string, evCtx *EvalContext, execCtx *ExecutionContext) (request *Request, err error)

LoadOnlyRequest Load only request with given EvalContext

func LoadWhole

func LoadWhole(name, env string, execCtx *ExecutionContext) (request *Request, err error)

LoadWhole Gather EvalContext and load given request

func (*Request) Exec

func (request *Request) Exec() error

func (*Request) SetMethod added in v1.0.0

func (request *Request) SetMethod(method string)

func (*Request) SetUrl added in v1.0.0

func (request *Request) SetUrl(urlToSet string)

type RequestAsVars

type RequestAsVars struct {
	sync.Map
}

func (*RequestAsVars) AsCtyMap added in v1.3.0

func (rv *RequestAsVars) AsCtyMap() map[string]cty.Value

type RequestCfg

type RequestCfg struct {
	Name      string          `hcl:"name,label"`
	DependsOn []string        `hcl:"depends_on,optional"`
	Remain    hcl.Body        `hcl:",remain"`
	Auth      *AuthCfg        `hcl:"auth,block"`
	Params    *ParamsBlockCfg `hcl:"params,block"`
	Repeat    int             `hcl:"repeat,optional"`
}

type RequestCfgs

type RequestCfgs []*RequestCfg

type RequestTiming

type RequestTiming struct {
	// DNS resolve time
	Dns time.Duration
	// Time to establish connection
	Conn time.Duration
	// TLS handshake time
	Tls time.Duration
	// Time to first byte
	FirstByte time.Duration
	// Total request duration
	Total time.Duration
}

type Requests

type Requests map[string]map[string]cty.Value

type Response

type Response struct {
	Method        string
	Url           string
	StatusCode    int
	Proto         string
	Body          []byte
	Headers       *Headers
	Timing        RequestTiming
	Request       *Request
	BytesSend     uint64
	BytesReceived uint64
}

type RootCfg

type RootCfg struct {
	Requests          RequestCfgs          `hcl:"request,block"`
	Variables         VariableCfgs         `hcl:"variable,block"`
	Dynamics          VariableCfgs         `hcl:"dynamic,block"`
	Environments      EnvironmentCfgs      `hcl:"env,block"`
	ExternalFunctions ExternalFunctionCfgs `hcl:"external-function,block"`
	Tests             TestCfgs             `hcl:"test,block"`
	Version           string               `hcl:"version,optional"`
}

type SecretCfg

type SecretCfg struct {
	Name  string            `hcl:"name,label"`
	Type  string            `hcl:"type,attr"`
	Paths map[string]string `hcl:"paths,attr"`
}

type SecretCfgs

type SecretCfgs []*SecretCfg

type Test added in v0.11.0

type Test struct {
	Name       string
	Assertions Assertions
}

func LoadTest added in v0.11.0

func LoadTest(name, env string, execCtx *ExecutionContext) (request *Test, err error)

type TestCfg added in v0.11.0

type TestCfg struct {
	Name string   `hcl:"name,label"`
	Body hcl.Body `hcl:",remain"`
}

type TestCfgs added in v0.11.0

type TestCfgs []*TestCfg

type Tests added in v0.12.0

type Tests []*Test

func LoadAllTests added in v0.12.0

func LoadAllTests(env string, execCtx *ExecutionContext) (tests Tests, err error)

type VariableCfg

type VariableCfg struct {
	Name  string   `hcl:"name,label"`
	Value hcl.Body `hcl:"value,remain"`
}

type VariableCfgs

type VariableCfgs []*VariableCfg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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