Documentation ¶
Index ¶
Constants ¶
const ( //URLKey represents url key URLKey = "URL" //CookieKey represents cookie header key CookieKey = "Cookie" //ContentTypeKey represents content type header key ContentTypeKey = "Content-Type" //MethodKey represents http method key MethodKey = "Method" //BodyKey represents http body key BodyKey = "Body" )
const (
//ServiceID represents hTTPEndpoint service id.
ServiceID = "http/endpoint"
)
Variables ¶
var HTTPRequestKeyProviders = make(map[string]HTTPRequestKeyProvider)
HTTPRequestKeyProviders represents key providers
Functions ¶
func StartRecorder ¶
StartRecorder starts HTTP recorded for supplied URLs
func StartServer ¶
func StartServer(port int, trips *HTTPServerTrips) error
StartServer starts http request, the server has ability to replay recorded HTTP trips with https://github.com/viant/toolbox/blob/master/bridge/http_bridge_recording_util.go#L82
Types ¶
type HTTPRequestKeyProvider ¶
HTTPRequestKeyProvider represents request key provider to extract a request field.
func HeaderProvider ¶
func HeaderProvider(header string) HTTPRequestKeyProvider
HeaderProvider return a header value for supplied source
type HTTPResponses ¶
type HTTPResponses struct { Request *bridge.HttpRequest Responses []*bridge.HttpResponse Index uint32 }
HTTPResponses represents HTTPResponses
type HTTPServerTrips ¶
type HTTPServerTrips struct { BaseDirectory string Rotate bool Trips map[string]*HTTPResponses IndexKeys []string Mutex *sync.Mutex }
HTTPServerTrips represents http trips
type ListenRequest ¶
type ListenRequest struct { Port int Rotate bool BaseDirectory string `` /* 164-byte string literal not displayed */ IndexKeys []string `description:"recorded requests matching keys, by default: Method,URL,Body,Cookie,Content-Type"` }
ListenRequest represent HTTP endpoint listen request
func (ListenRequest) AsHTTPServerTrips ¶
func (r ListenRequest) AsHTTPServerTrips() *HTTPServerTrips
AsHTTPServerTrips return a new HTTP trips.
func (ListenRequest) Validate ¶
func (r ListenRequest) Validate() error
Validate checks if request is valid.
type ListenResponse ¶
type ListenResponse struct {
Trips map[string]*HTTPResponses
}
ListenResponse represents HTTP endpoint listen response with indexed trips