Documentation ¶
Index ¶
- func CompressHandler(listener interfaces.Listener, h http.Handler) http.Handler
- func CompressHandlerLevel(listener interfaces.Listener, h http.Handler, level int) http.Handler
- func CompressWriter(w http.ResponseWriter) (io.WriteCloser, string)
- func FinalHandler(h http.Handler, k int, interceptor []interfaces.Interceptor) http.Handler
- func Init(listener interfaces.Listener, route *mux.Router, h http.Handler) http.Handler
- func Interceptor(listener interfaces.Listener, h http.Handler) http.Handler
- func NewPanicOutput(ctx context.Context, w http.ResponseWriter)
- func PanicRecovery(listener interfaces.Listener) func(h http.Handler) http.Handler
- func SetCookie(name, value string, w http.ResponseWriter)
- type ErrorLogs
- type HeaderValues
- type PanicMessage
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressHandler ¶
CompressHandler gzip compresses HTTP responses for clients that support it via the 'Accept-Encoding' header.
Compressing TLS traffic may leak the page contents to an attacker if the page contains user input: http://security.stackexchange.com/a/102015/12208
func CompressHandlerLevel ¶
CompressHandlerLevel gzip compresses HTTP responses with specified compression level for clients that support it via the 'Accept-Encoding' header.
The compression level should be gzip.DefaultCompression, gzip.NoCompression, or any integer value between gzip.BestSpeed and gzip.BestCompression inclusive. gzip.DefaultCompression is used in case of invalid compression level.
func CompressWriter ¶
func CompressWriter(w http.ResponseWriter) (io.WriteCloser, string)
func FinalHandler ¶
func FinalHandler(h http.Handler, k int, interceptor []interfaces.Interceptor) http.Handler
func Interceptor ¶
func NewPanicOutput ¶
func NewPanicOutput(ctx context.Context, w http.ResponseWriter)
func PanicRecovery ¶
func SetCookie ¶
func SetCookie(name, value string, w http.ResponseWriter)
Types ¶
type ErrorLogs ¶
type ErrorLogs struct { Code string `json:"Grpc-Status"` Msg interface{} `json:"Grpc-Message"` }
type HeaderValues ¶
type HeaderValues struct {
AcceptEncoding string
}
type PanicMessage ¶
type PanicMessage struct { Message interface{} `json:"message"` TraceID string `json:"traceId"` }
type ResponseWriter ¶
type ResponseWriter struct { Request *http.Request http.ResponseWriter Buffer *bytes.Buffer BeforeFlush func([]byte) BeforeWriteHeader func(co int) StatusCode int // contains filtered or unexported fields }
func NewResponseWriter ¶
func NewResponseWriter(listener interfaces.Listener, w http.ResponseWriter, r *http.Request) *ResponseWriter
func (*ResponseWriter) Flush ¶
func (c *ResponseWriter) Flush()
func (*ResponseWriter) Header ¶
func (c *ResponseWriter) Header() http.Header
func (*ResponseWriter) WriteHeader ¶
func (c *ResponseWriter) WriteHeader(co int)
Click to show internal directories.
Click to hide internal directories.