httputils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const InLimit = 10 * (1 << 20)

Variables

This section is empty.

Functions

func CheckAuthorized added in v0.3.0

func CheckAuthorized(mm *pluginapi.Client, f func(_ http.ResponseWriter, _ *http.Request, sessionID, actingUserID string)) http.HandlerFunc

func LimitReadAll added in v0.2.0

func LimitReadAll(in io.Reader, limit int64) ([]byte, error)

func NormalizeRemoteBaseURL

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

func ProcessResponseError added in v0.2.0

func ProcessResponseError(w http.ResponseWriter, resp *http.Response, err error) bool

func ReadAndClose added in v0.2.0

func ReadAndClose(in io.ReadCloser) ([]byte, error)

func WriteError added in v0.2.0

func WriteError(w http.ResponseWriter, err error)

func WriteJSON

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

func WriteJSONStatus

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

Types

type Handler

type Handler struct {
	*mux.Router
}

func NewHandler

func NewHandler() *Handler

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