Documentation
¶
Index ¶
- Constants
- func DoJSON(c Client, resbody any, req *http.Request) error
- func GetJSON(ctx context.Context, c Client, resbody any, url string) error
- func JSONHandler[T any](h func(http.ResponseWriter, *http.Request, T)) http.Handler
- func LogHandler(h http.Handler) http.Handler
- func NewRequestJSON(ctx context.Context, method, url string, reqbody any) (*http.Request, error)
- func PostJSON(ctx context.Context, c Client, resbody any, url string, reqbody any) error
- func WriteJSON(w http.ResponseWriter, statusCode int, data any)
- type Client
- type ErrorJSON
- type NGStatusError
Constants ¶
View Source
const ( HeaderOrigin = "Origin" HeaderContentType = "Content-Type" ContentTypeJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func JSONHandler ¶
func NewRequestJSON ¶
Types ¶
type NGStatusError ¶
type NGStatusError struct {
// Response.Body is consumed and set Body.
Response *http.Response
Body []byte
}
NGStatusError is returned if a status code of Response is over 400.
func (*NGStatusError) Error ¶
func (e *NGStatusError) Error() string
Click to show internal directories.
Click to hide internal directories.