httputils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSONError

func DecodeJSONError(body io.ReadCloser) error

func NormalizeRemoteBaseURL

func NormalizeRemoteBaseURL(mattermostSiteURL, remoteURL string) (string, error)

func WriteBadRequestError

func WriteBadRequestError(w http.ResponseWriter, err error)

func WriteInternalServerError

func WriteInternalServerError(w http.ResponseWriter, err error)

func WriteJSON

func WriteJSON(w http.ResponseWriter, v interface{})

func WriteJSONError

func WriteJSONError(w http.ResponseWriter, statusCode int, summary string, err error)

func WriteJSONStatus

func WriteJSONStatus(w http.ResponseWriter, statusCode int, v interface{})

func WriteNotFoundError

func WriteNotFoundError(w http.ResponseWriter, err error)

func WriteUnauthorizedError

func WriteUnauthorizedError(w http.ResponseWriter, err error)

Types

type Handler

type Handler struct {
	*mux.Router
}

func NewHandler

func NewHandler() *Handler

type JSONError

type JSONError struct {
	Error   string `json:"error"`
	Summary string `json:"details"`
}

type LimitReadCloser

type LimitReadCloser struct {
	ReadCloser io.ReadCloser
	TotalRead  utils.ByteSize
	Limit      utils.ByteSize
	OnClose    func(*LimitReadCloser) error
}

func (*LimitReadCloser) Close

func (r *LimitReadCloser) Close() error

func (*LimitReadCloser) Read

func (r *LimitReadCloser) Read(data []byte) (int, error)

Jump to

Keyboard shortcuts

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