Documentation ¶
Index ¶
- func GetRealIP(r *http.Request) string
- func HTTPGetWithAuth(ctx context.Context, url string, auth string) (string, error)
- func IsPrivateIP(ipAddr string) (bool, error)
- func RespondSuccess(w http.ResponseWriter)
- func RespondWithError(w http.ResponseWriter, code int, message string)
- func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
- type HttpError
- func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) *HttpError
- func NewBadRequestError(err error, msg string) *HttpError
- func NewForbiddenError() *HttpError
- func NewHttpError(code int, err error, msg string) *HttpError
- func NewInternalError(err error) *HttpError
- func NewNotFoundError() *HttpError
- func NewRequestEntityTooLargeError(err error, msg string) *HttpError
- func NewUnauthorizedError(err error) *HttpError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPGetWithAuth ¶
HTTPGetWithAuth sends a GET request to a specified URL with authorization header
func IsPrivateIP ¶
func RespondSuccess ¶
func RespondSuccess(w http.ResponseWriter)
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, message string)
func RespondWithJSON ¶
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
Types ¶
type HttpError ¶
func DecodeJSONBody ¶
func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) *HttpError
func NewBadRequestError ¶
func NewForbiddenError ¶
func NewForbiddenError() *HttpError
func NewInternalError ¶
func NewNotFoundError ¶
func NewNotFoundError() *HttpError
func NewUnauthorizedError ¶
Click to show internal directories.
Click to hide internal directories.