Help us shape the future of Go! Take the 2026 Go Developer Survey

http

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

README

Http runner service

Http runner sends one or more HTTP request to the specified endpoint; it manages cookie within SendRequest.

Service Id Action Description Request Response
http/runner send Sends one or more http request to the specified endpoint. SendRequest SendResponse

Documentation

Index

Constants

View Source
const PreviousTripStateKey = "previous"

PreviousTripStateKey keys to store previous request details for multi trip HTTP Send request in context state

View Source
const ServiceID = "http/runner"

ServiceID represents http runner service id.

Variables

This section is empty.

Functions

func New

func New() endly.Service

New creates a new http runner service

Types

type Cookies

type Cookies []*http.Cookie

Cookies represents cookie

func (*Cookies) AddCookies

func (c *Cookies) AddCookies(cookies ...*http.Cookie)

AddCookies adds cookies

func (*Cookies) IndexByName

func (c *Cookies) IndexByName() map[string]*http.Cookie

IndexByName index cookie by name

func (*Cookies) IndexByPosition

func (c *Cookies) IndexByPosition() map[string]int

IndexByPosition index cookie by position

func (*Cookies) SetHeader

func (c *Cookies) SetHeader(header http.Header)

SetHeader sets cookie header

type Request

type Request struct {
	*model.Repeater
	When        string `description:"criteria to send this request"`
	Method      string `required:"true" description:"HTTP Method"`
	URL         string
	Header      http.Header
	Cookies     Cookies
	Body        string
	Replace     map[string]string `description:"response body key value pair replacement"`
	RequestUdf  string            `description:"user defined function in context.state key, i,e, json to protobuf"`
	ResponseUdf string            `description:"user defined function in context.state key, i,e, protobuf to json"`
}

ServiceRequest represents an http request

func (*Request) Expand

func (r *Request) Expand(context *endly.Context) *Request

Expand substitute request data with matching context map state.

func (*Request) IsInput

func (r *Request) IsInput() bool

IsInput returns this request (CLI reporter interface)

func (*Request) Messages

func (r *Request) Messages() []*msg.Message

Messages returns messages

type Response

type Response struct {
	//ServiceRequest     *ServiceRequest
	Code        int
	Header      http.Header
	Cookies     map[string]*http.Cookie
	Body        string
	JSONBody    map[string]interface{} `description:"structure data if Body was JSON"`
	TimeTakenMs int
	Error       string
}

Response represents Http response

func (*Response) IsOutput

func (r *Response) IsOutput() bool

IsOutput returns this response (CLI reporter interface)

func (*Response) Messages

func (r *Response) Messages() []*msg.Message

Messages returns messages

type SendRequest

type SendRequest struct {
	Options  []*toolbox.HttpOptions `` /* 201-byte string literal not displayed */
	Requests []*Request
	Expect   interface{} `description:"If specified it will validated response as actual"`
}

SendRequest represents a send http request.

type SendResponse

type SendResponse struct {
	Responses []*Response
	Data      data.Map
	Assert    *validator.AssertResponse
}

SendResponse represnets a send response

Jump to

Keyboard shortcuts

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