config

package
Version: v0.0.0-...-32f3f7c Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateExample

func GenerateExample() ([]byte, error)

GenerateExample generates example config YAML output.

Types

type Request

type Request struct {
	Headers map[string]string `yaml:"headers"`
	Method  string            `yaml:"method,omitempty"`
	Path    string            `yaml:"path,omitempty"`
	Body    string            `yaml:"body,omitempty"`
}

type Response

type Response struct {
	Headers map[string]string `yaml:"headers"`
	Body    string            `yaml:"body,omitempty"`
	Code    int               `yaml:"code,omitempty"`
}

type TestSpec

type TestSpec struct {
	Request          Request  `yaml:"request"`
	Response         Response `yaml:"response"`
	TimeoutSeconds   int      `yaml:"timeout_seconds"`
	SkipValidateBody bool     `yaml:"skip_validate_body"`
}

func Parse

func Parse(b []byte) (*TestSpec, error)

Parse []byte config to TestSpec.

func (*TestSpec) SendRequest

func (t *TestSpec) SendRequest(addr string) (*Response, error)

SendRequest sends a request to a server and returns the test response.

func (*TestSpec) Update

func (t *TestSpec) Update() ([]byte, error)

Update returns the generated config from the TestSpec.

func (*TestSpec) Validate

func (t *TestSpec) Validate(response Response) ([]string, error)

Validate runs trough the expected response against the actual response and returns an array with issues.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL