request

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2017 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Response    *http.Response
	RequestTime time.Duration
	Content     []byte
	Request     *http.Request
	Payload     []byte
}

func Do

func Do(config *endpoint.EndpointConfig) (*Response, error)

func (*Response) IsResponseJSON

func (res *Response) IsResponseJSON() bool

type ScriptEngine

type ScriptEngine struct {
	VM             *otto.Otto
	Constants      map[string]string
	AssetPath      string
	Response       *Response
	EndpointConfig *endpoint.EndpointConfig
	Payload        []byte
	Request        *http.Request
	Debug          string
}

ScriptEngine - A scripting engine used to execute hook scripts during the request process. It is built to execute arbitrary Javascript.

func NewScriptEngine

func NewScriptEngine(endpointConfig *endpoint.EndpointConfig) *ScriptEngine

NewScriptEngine - Generates a new script engine.

func (*ScriptEngine) Execute

func (eng *ScriptEngine) Execute(script string) error

Execute - Executes a Javascript.

func (*ScriptEngine) ExecuteFile

func (eng *ScriptEngine) ExecuteFile(filepath string) error

ExecuteFile - Executes a script contianed in a file.

func (*ScriptEngine) ExecuteTransform

func (eng *ScriptEngine) ExecuteTransform(script string, payload []byte) []byte

ExecuteTransform - Executes the script and with a payload value set and returns the newly set payload. Used for performing request transformations.

func (*ScriptEngine) SetResponse

func (eng *ScriptEngine) SetResponse(res *Response)

SetResponse - Used to set the web respone on the engine. It also makes this available to the script.

func (*ScriptEngine) Validate

func (eng *ScriptEngine) Validate(script string) error

Validate - Validates that the Javascript is valid.

Jump to

Keyboard shortcuts

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