httpsimple

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EngineAwsLambda = "awslambda"
	EngineNetHttp   = "nethttp"
	EngineFastHttp  = "fasthttp"
)

Variables

This section is empty.

Functions

func HandleTestAnyEngine added in v0.0.5

func HandleTestAnyEngine(aRes anyhttp.Response, aReq anyhttp.Request)

func HandleTestFastHTTP added in v0.0.5

func HandleTestFastHTTP(ctx *fasthttp.RequestCtx)

func HandleTestNetHTTP added in v0.0.5

func HandleTestNetHTTP(res http.ResponseWriter, req *http.Request)

func Serve

func Serve(svc SimpleServer)

Types

type SimpleClient

type SimpleClient struct {
	BaseURL    string
	HTTPClient *http.Client
}

SimpleClient provides a simple interface to making HTTP requests using `net/http`.

func NewSimpleClient

func NewSimpleClient(httpClient *http.Client, baseURL string) SimpleClient

func (*SimpleClient) Do

func (sc *SimpleClient) Do(req SimpleRequest) (*http.Response, error)

func (*SimpleClient) Get

func (sc *SimpleClient) Get(reqURL string) (*http.Response, error)

type SimpleRequest

type SimpleRequest struct {
	Method  string
	URL     string
	Headers map[string]string
	Body    interface{}
	IsJSON  bool
}

func (*SimpleRequest) BodyBytes

func (req *SimpleRequest) BodyBytes() ([]byte, error)

func (*SimpleRequest) Inflate

func (req *SimpleRequest) Inflate()

type SimpleServer

type SimpleServer interface {
	PortInt() int
	HttpEngine() string
	Router() http.Handler
	RouterFast() *fasthttprouter.Router
}

type TestResponse added in v0.0.5

type TestResponse struct {
	Command    string    `json:"command"`
	RequestURL string    `json:"requestURL"`
	Time       time.Time `json:"time"`
}

Jump to

Keyboard shortcuts

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