event

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRequestListener

func AddRequestListener(l HandleResultConsumer)

AddRequestListener adds a listener to handle request results

func EmitHandleResult

func EmitHandleResult(h HandleResult)

EmitHandleResult emits a handle result event to all listeners

func RemoveRequestListener

func RemoveRequestListener(toRemove HandleResultConsumer)

RemoveRequestListener removes a listener from the list

Types

type HandleBodyAndHeaders

type HandleBodyAndHeaders struct {
	Body    []byte              `json:"body"`
	Headers map[string][]string `json:"headers"`
}

HandleBodyAndHeaders stores headers and body for a request or response

type HandleResult

type HandleResult struct {
	Error       string `json:"error"`
	ExecutedURL string `json:"executedURL"`
	ID          string `json:"id"`
	HandledBy   string `json:"handledBy"`
	Method      string `json:"method"`
	StatusCode  int    `json:"statusCode"`
	URL         string `json:"url"`

	Request  HandleBodyAndHeaders `json:"request"`
	Response HandleBodyAndHeaders `json:"response"`

	Timings HandleTimings `json:"timings"`
}

HandleResult stores information about handled requests

type HandleResultConsumer

type HandleResultConsumer interface {
	Consume(HandleResult)
}

HandleResultConsumer consumes handle result messages

type HandleTimings

type HandleTimings struct {
	Completed int64 `json:"completed"`
	Handled   int64 `json:"handled"`
	Matched   int64 `json:"matched"`
	Started   int64 `json:"started"`
}

HandleTimings stores information about the timings

Jump to

Keyboard shortcuts

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