Documentation ¶
Index ¶
- Variables
- func ConcatenateJSON(first, second []byte) ([]byte, error)
- func FormRequest(endpoint string, request any, encoder Encoder, authFn any) (*http.Request, error)
- func HttpRequest(client *http.Client, req *http.Request, response any) error
- func MarshalJSON(w http.ResponseWriter, i any)
- func MarshalJSONWithStatus(w http.ResponseWriter, i any, status int)
- func StartServer(ctx context.Context, port string)
- func URLEncodeParams(resp any, encoder Encoder) (url.Values, error)
- type CookieHandler
- func (c *CookieHandler) CheckCookie(r *http.Request, name string) (string, error)
- func (c *CookieHandler) CheckQueryCookie(r *http.Request, name string) (string, error)
- func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, name string)
- func (c *CookieHandler) SetCookie(w http.ResponseWriter, name, value string) error
- type CookieHandlerOpt
- type Decoder
- type Encoder
- type FormAuthorization
- type RequestAuthorization
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPClient = &http.Client{ Timeout: 30 * time.Second, }
Functions ¶
func ConcatenateJSON ¶
func FormRequest ¶
func MarshalJSON ¶
func MarshalJSON(w http.ResponseWriter, i any)
func MarshalJSONWithStatus ¶
func MarshalJSONWithStatus(w http.ResponseWriter, i any, status int)
func StartServer ¶
Types ¶
type CookieHandler ¶
type CookieHandler struct {
// contains filtered or unexported fields
}
func NewCookieHandler ¶
func NewCookieHandler(hashKey, encryptKey []byte, opts ...CookieHandlerOpt) *CookieHandler
func (*CookieHandler) CheckCookie ¶
func (*CookieHandler) CheckQueryCookie ¶
func (*CookieHandler) DeleteCookie ¶
func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, name string)
func (*CookieHandler) SetCookie ¶
func (c *CookieHandler) SetCookie(w http.ResponseWriter, name, value string) error
type CookieHandlerOpt ¶
type CookieHandlerOpt func(*CookieHandler)
func WithDomain ¶
func WithDomain(domain string) CookieHandlerOpt
func WithMaxAge ¶
func WithMaxAge(maxAge int) CookieHandlerOpt
func WithPath ¶
func WithPath(path string) CookieHandlerOpt
func WithSameSite ¶
func WithSameSite(sameSite http.SameSite) CookieHandlerOpt
func WithUnsecure ¶
func WithUnsecure() CookieHandlerOpt
type FormAuthorization ¶
type RequestAuthorization ¶
func AuthorizeBasic ¶
func AuthorizeBasic(user, password string) RequestAuthorization
Click to show internal directories.
Click to hide internal directories.