delphi.market/test/mocks.go

24 lines
415 B
Go
Raw Normal View History

package test
import (
"io"
"net/http"
"net/http/httptest"
"github.com/labstack/echo/v4"
)
func HTTPMocks(method string, target string, body io.Reader) (*echo.Echo, *http.Request, *httptest.ResponseRecorder) {
var (
e *echo.Echo
req *http.Request
rec *httptest.ResponseRecorder
)
e = echo.New()
2024-07-09 20:41:29 +00:00
req = httptest.NewRequest(method, target, body)
rec = httptest.NewRecorder()
2024-07-09 20:41:29 +00:00
return e, req, rec
}