httputil

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetScheme

func GetScheme(req *http.Request) string

func HeaderCopyTo

func HeaderCopyTo(src, dst http.Header)

HeaderCopyTo

func RemoveHopHeaders

func RemoveHopHeaders(header http.Header)

RemoveHopHeaders

func SetupGracefulStop

func SetupGracefulStop(srv *http.Server)

func Shutdown

func Shutdown(srv *http.Server)

Types

type Client

type Client struct {
	*Resty
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string, resourcePath string) *Client

func (*Client) Create

func (rc *Client) Create(spec interface{}) error

func (*Client) Delete

func (rc *Client) Delete(name string) error

func (*Client) Find

func (rc *Client) Find(name string, result interface{}) error

func (*Client) FindAll

func (rc *Client) FindAll(query url.Values, result interface{}) error

func (*Client) Update

func (rc *Client) Update(spec interface{}) error

type JSONResponse

type JSONResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

JSONResponse

func BindJSONResponse

func BindJSONResponse(data []byte) *JSONResponse

func NewJSONResponse

func NewJSONResponse(data interface{}) *JSONResponse

JSONResponse

func (*JSONResponse) Error

func (e *JSONResponse) Error() error

type Resty

type Resty struct {
	*resty.Client
	// contains filtered or unexported fields
}

func NewResty

func NewResty(baseURL string) *Resty

func (*Resty) Create

func (x *Resty) Create(resource string, body interface{}) error

func (*Resty) Delete

func (x *Resty) Delete(resource string) error

func (*Resty) Get

func (x *Resty) Get(resource string, v interface{}) error

func (*Resty) Update

func (x *Resty) Update(resource string, body interface{}) error

type ReverseProxy

type ReverseProxy struct {
	httputil.ReverseProxy
}

func NewReverseProxy

func NewReverseProxy(target *url.URL, header http.Header) *ReverseProxy

Jump to

Keyboard shortcuts

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