request

package
v0.0.0-...-01c0eb4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Kind string      `json:"kind"`
	Name string      `json:"name"`
	Spec RequestSpec `json:"spec"`
}

Request represents a single resource which in itself can represent multiple types of requests for said resource, by creating RequestVariants.

func (*Request) Make

func (r *Request) Make(baseURL url.URL) (*http.Response, RequestStat, error)

Make makes a single HTTP request without a variant. Only the fields that come from the request will be used.

func (*Request) MakeWithVariant

func (r *Request) MakeWithVariant(
	baseURL url.URL, v *Variant) (*http.Response, RequestStat, error)

Make makes an HTTP request requing the baseURL and the variant of the request resource.

func (Request) Variant

func (r Request) Variant(n string) (Variant, error)

Variant checks for and returns a variant given by it's name.

func (Request) Variants

func (r Request) Variants() Variants

Variants returns a slice of Variant for each one that exists on the given Request resource.

type RequestSpec

type RequestSpec struct {
	Uri         string            `json:"uri"`
	Method      string            `json:"method"`
	Data        requestData       `json:"data"`
	FormData    url.Values        `json:"formData"`
	Headers     http.Header       `json:"headers"`
	Variants    Variants          `json:"variants"`
	StashValues stash.StashValues `json:"stashValues"`
}

RequestSpec represents the specification of the base request resource without any variants. A request can be made this way individually if there are no variants of it.

func (*RequestSpec) UnmarshalJSON

func (rs *RequestSpec) UnmarshalJSON(j []byte) error

UnmarshalJSON will ensure that the request headers that are by default passed through as string values will become type http.Header upon unmarshling the JSON.

func (*RequestSpec) Update

func (rs *RequestSpec) Update()

Update modifies the request spec to include any data that has recently been added to the stash. If new values exist, the values within the request spec will be added at this point.

type RequestStat

type RequestStat struct {
	Total int
}

type Requests

type Requests []Request

Requests represents multiple Request resources.

type Variant

type Variant struct {
	Name        string            `json:"name"`
	Path        string            `json:"path"`
	Method      string            `json:"method"`
	Data        requestData       `json:"data"`
	FormData    url.Values        `json:"formData"`
	Headers     http.Header       `json:"headers"`
	StashValues stash.StashValues `json:"stashValues"`
}

RequestVariant represents a given variant for an HTTP request. This could be related to the same resource, but using a different request method or path for example.

func (*Variant) UnmarshalJSON

func (v *Variant) UnmarshalJSON(j []byte) error

type Variants

type Variants []Variant

RequestVariants represent multiple RequestVariant

func (Variants) Names

func (vs Variants) Names() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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