echotest

package
v0.8.31 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 TestCase added in v0.8.30

type TestCase struct {
	Request

	ExpectedCode   int
	ExpectedHeader map[string]string
	ExpectedBody   string
	ExpectedErr    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