Documentation
¶
Index ¶
- Constants
- func BindJSON(r *http.Request, obj any) error
- func BindProto(r *http.Request, msg proto.Message) error
- func Client() *resty.Client
- func ContentType(h http.Header) string
- func Form(ctx context.Context, url string, form url.Values, header ...http.Header) (resp *resty.Response, err error)
- func Get(ctx context.Context, url string, query url.Values, header ...http.Header) (resp *resty.Response, err error)
- func Header(next http.Handler) http.Handler
- func Log(next http.Handler) http.Handler
- func NewHttpClient() *http.Client
- func ParseProto(r *http.Request, msg proto.Message) error
- func Post(ctx context.Context, url string, body any, header ...http.Header) (resp *resty.Response, err error)
- func Recovery(next http.Handler) http.Handler
- func Serve(ctx context.Context, addr string, chiFunc func(r chi.Router), ...)
- type Result
- func FormX[T any](ctx context.Context, url string, form url.Values, header ...http.Header) (ret *Result[T], err error)
- func GetX[T any](ctx context.Context, url string, query url.Values, header ...http.Header) (ret *Result[T], err error)
- func PostX[T any](ctx context.Context, url string, body any, header ...http.Header) (ret *Result[T], err error)
Constants ¶
View Source
const ( HeaderAccept = "Accept" HeaderAuthorization = "Authorization" HeaderContentType = "Content-Type" )
View Source
const ( ContentText = "text/plain; charset=utf-8" ContentJSON = "application/json" ContentXML = "application/xml" ContentForm = "application/x-www-form-urlencoded" ContentStream = "application/octet-stream" ContentMultipartForm = "multipart/form-data" )
View Source
const MaxLogSize = 32 << 10 // 32KB
Variables ¶
This section is empty.
Functions ¶
func ContentType ¶
func Header ¶ added in v0.3.0
Header is a middleware that injects http headers into the context of each request.
Types ¶
Click to show internal directories.
Click to hide internal directories.