Documentation
¶
Index ¶
- type ApiError
- type Client
- func (cl *Client) App() *zip.App
- func (cl *Client) Defaults(fn defaultsFunc)
- func (cl *Client) Delete(uri string, args ...interface{}) *httptest.ResponseRecorder
- func (c *Client) Do(req *http.Request) *httptest.ResponseRecorder
- func (cl *Client) Get(uri string, res interface{}, args ...interface{}) *httptest.ResponseRecorder
- func (cl *Client) Handle(method, path string, handler zip.Handler)
- func (cl *Client) Head(uri string, args ...interface{}) *httptest.ResponseRecorder
- func (cl *Client) IgnoreErrors(ignore bool)
- func (cl *Client) NewRequest(method, uri string, reader io.Reader) *http.Request
- func (cl *Client) Options(uri string, args ...interface{}) *httptest.ResponseRecorder
- func (cl *Client) Patch(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder
- func (cl *Client) Post(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder
- func (c *Client) PostForm(path string, data url.Values) *httptest.ResponseRecorder
- func (c *Client) PostJSON(path string, src interface{}) *httptest.ResponseRecorder
- func (c *Client) PostRawJSON(path string, src string) *httptest.ResponseRecorder
- func (cl *Client) Put(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder
- func (cl *Client) Use(mw ...zip.Handler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client drives a zip.App under test the way the old ginclient drove a gin.Engine: register routes/middleware on Router, then issue requests that return an *httptest.ResponseRecorder (Code/Body) exactly as before. Requests run through the zap-proto/fiber net/http adaptor, so the full middleware chain and routing are exercised — no gin, no shims.
There is deliberately no post-request Context handle (the old ginclient exposed one): fiber pools and resets the *Ctx when the request completes, so reading it afterward panics. A test that needs the resolved context state reads it INSIDE the handler it registers (where the Ctx is live).
func (*Client) Delete ¶
func (cl *Client) Delete(uri string, args ...interface{}) *httptest.ResponseRecorder
Make DELETE request Accepts optional args: int (expected status code, default 204), url.Values (query params), or any other type (decoded as JSON response destination).
func (*Client) Get ¶
func (cl *Client) Get(uri string, res interface{}, args ...interface{}) *httptest.ResponseRecorder
Make GET request
func (*Client) Head ¶
func (cl *Client) Head(uri string, args ...interface{}) *httptest.ResponseRecorder
Make HEAD request
func (*Client) IgnoreErrors ¶
func (*Client) NewRequest ¶
func (*Client) Options ¶
func (cl *Client) Options(uri string, args ...interface{}) *httptest.ResponseRecorder
Make OPTIONS request
func (*Client) Patch ¶
func (cl *Client) Patch(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder
Make PATCH request
func (*Client) Post ¶
func (cl *Client) Post(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder
Make POST request
func (*Client) PostJSON ¶
func (c *Client) PostJSON(path string, src interface{}) *httptest.ResponseRecorder
Make POST with JSON Data
func (*Client) PostRawJSON ¶
func (c *Client) PostRawJSON(path string, src string) *httptest.ResponseRecorder
Make POST with Raw JSON Data