network

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Method string `json:"method" yaml:"method,omitempty"`
	URL    string `json:"url" yaml:"url"`
	// StatusCode should contain the expected http status code, if not defined,
	// status codes starting with 1xx, 2xx, and 3xx will be considered successful,
	// and 4xx, and 5xx codes will be considered failures
	StatusCode int `json:"statusCode" yaml:"statusCode,omitempty"`
	// Headers contains headers key-value pairs that should be present in the
	// HTTP headers of the response
	Headers map[string]string `json:"headers" yaml:"headers,omitempty"`
	// ResponseBody is a regex-supported match with the response body
	ResponseBody string `json:"responseBody" yaml:"responseBody,omitempty"`
	// contains filtered or unexported fields
}

Check represents a network check

func (*Check) GetObserved

func (c *Check) GetObserved() (http.Response, error)

GetObserved returns the response object from the check; if no check has been performed yet, the http.Response will be of zero value with an error

func (*Check) Run

func (c *Check) Run() error

Run executes the target network check and places the response in the .observed property (used by .Verify to check if the check succeeded); Run will return an error on any network issues that result in the .observed property not being populated

func (Check) Verify

func (c Check) Verify() error

Verify compares the expected values and the observed outcome, returning an error if the verification failed.

type Network

type Network struct {
	Name            string `json:"name" yaml:"name,omitempty"`
	RegistrationURL string `json:"registrationUrl" yaml:"registrationUrl,omitempty"`
	Check           Check  `json:"check" yaml:"check,omitempty"`
}

Network defines the configuration structure for the `network` property in the configuration file

Jump to

Keyboard shortcuts

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