ginclient

package
v1.46.33 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Error struct {
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"error"`
}

type Client

type Client struct {
	Router  *gin.Engine
	Context *gin.Context
	// contains filtered or unexported fields
}

func New

func New(ctx ae.Context) *Client

func (*Client) Defaults

func (cl *Client) Defaults(fn defaultsFunc)

Set defaults for each request

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) Do

func (*Client) Get

func (cl *Client) Get(uri string, res interface{}, args ...interface{}) *httptest.ResponseRecorder

Make GET request

func (*Client) Handle

func (cl *Client) Handle(method, path string, handler gin.HandlerFunc)

Add a new handler to router

func (*Client) Head

func (cl *Client) Head(uri string, args ...interface{}) *httptest.ResponseRecorder

Make HEAD request

func (*Client) IgnoreErrors

func (cl *Client) IgnoreErrors(ignore bool)

func (*Client) NewRequest

func (cl *Client) NewRequest(method, uri string, reader io.Reader) *http.Request

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) PostForm

func (c *Client) PostForm(path string, data url.Values) *httptest.ResponseRecorder

Make POST with Form Data

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

func (*Client) Put

func (cl *Client) Put(uri string, body interface{}, res interface{}, args ...interface{}) *httptest.ResponseRecorder

Make PUT request

func (*Client) Use

func (cl *Client) Use(mw ...gin.HandlerFunc)

Add middleware to router

Jump to

Keyboard shortcuts

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