http

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanURI

func CleanURI(name string) string

CleanURI - cleans and validates the URI

func CopyHeaders

func CopyHeaders(source http.Header, dest http.Header)

CopyHeaders - copy all the headers

Types

type RequestData

type RequestData struct {
	URI     string
	Body    string
	Method  string
	Headers http.Header
	Date    time.Time
}

RequestData - the request data sent to the server

func WaitForServerRequest

func WaitForServerRequest(server *Server, waitFor, maxRequestTimeout time.Duration) *RequestData

WaitForServerRequest - wait until timeout or for the server sets the request in the channel

type ResponseData

type ResponseData struct {
	RequestData
	Status int
}

ResponseData - the expected response data for each configured URI

func DoRequest

func DoRequest(testServerHost string, testServerPort int, request *RequestData) *ResponseData

DoRequest - does a request

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server - the server listening for HTTP requests

func NewServer

func NewServer(host string, port, channelSize int, responses []ResponseData) *Server

NewServer - creates a new HTTP listener server

func (*Server) Close

func (hs *Server) Close()

Close - closes this server

func (*Server) RequestChannel

func (hs *Server) RequestChannel() <-chan *RequestData

RequestChannel - reads from the request channel

Jump to

Keyboard shortcuts

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