echotest

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do added in v0.9.1

func Do(handler echo.HandlerFunc, req *http.Request, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

Do request against the handler

func DoDELETE

func DoDELETE(handler echo.HandlerFunc, url string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoDELETE return echo.Context and httptest.ResponseRecorder for DELETE Request (deprecated)

func DoGET

func DoGET(handler echo.HandlerFunc, url string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoGET return recorder and error for GET API (deprecated)

func DoPATCH added in v0.9.1

func DoPATCH(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPATCH return echo.Context and httptest.ResponseRecorder for PUT Request (deprecated)

func DoPOST

func DoPOST(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPOST return echo.Context and httptest.ResponseRecorder for POST Request (deprecated)

func DoPUT

func DoPUT(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPUT return echo.Context and httptest.ResponseRecorder for PUT Request (deprecated)

func HeaderForJSON added in v0.8.30

func HeaderForJSON() map[string]string

HeaderForJSON to generate header for json-based API

Types

type Request added in v0.8.30

type Request struct {
	Method    string
	Target    string
	Body      string
	Header    map[string]string
	URLParams map[string]string
}

Request for testcase

type Response added in v0.9.0

type Response struct {
	Code   int
	Header map[string]string
	Body   string
}

Response that expected

type TestCase added in v0.8.30

type TestCase struct {
	Request          Request
	ExpectedResponse Response
	ExpectedError    string
}

TestCase for echo

func (*TestCase) Execute added in v0.8.30

func (tt *TestCase) Execute(t *testing.T, fn echo.HandlerFunc)

Execute test case against handle function

Jump to

Keyboard shortcuts

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