rkmuxmid

package
v1.2.18 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package rkmuxmid provides common utility functions for middleware of mux framework

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJson

func WriteJson(w http.ResponseWriter, code int, content interface{})

WriteJson with code and content. Internal error will be written if error occur.

Types

type RkResponseWriter

type RkResponseWriter struct {
	Writer http.ResponseWriter
	Code   int
	Size   atomic.Int
}

A RkResponseWriter is a helper to delay sealing a http.ResponseWriter on writing code.

func WrapResponseWriter

func WrapResponseWriter(w http.ResponseWriter) *RkResponseWriter

WrapResponseWriter if current writer is not RkResponseWriter

func (*RkResponseWriter) Flush

func (w *RkResponseWriter) Flush()

Flush flushes the response writer.

func (*RkResponseWriter) Header

func (w *RkResponseWriter) Header() http.Header

Header returns the http header.

func (*RkResponseWriter) Hijack

func (w *RkResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

Hijack implements the http.Hijacker interface. This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.

func (*RkResponseWriter) Write

func (w *RkResponseWriter) Write(bytes []byte) (int, error)

Write writes bytes into w.

func (*RkResponseWriter) WriteHeader

func (w *RkResponseWriter) WriteHeader(code int)

WriteHeader writes code into w, and not sealing the writer.

Directories

Path Synopsis
Package rkmuxauth is auth middleware for mux framework
Package rkmuxauth is auth middleware for mux framework
Package rkmuxctx defines utility functions and variables used by gorilla/mux middleware
Package rkmuxctx defines utility functions and variables used by gorilla/mux middleware
Package rkmuxcors is a CORS middleware for mux framework
Package rkmuxcors is a CORS middleware for mux framework
Package rkmuxcsrf is a middleware for mux framework which validating csrf token for RPC
Package rkmuxcsrf is a middleware for mux framework which validating csrf token for RPC
Package rkmuxjwt is a middleware for mux framework which validating jwt token for RPC
Package rkmuxjwt is a middleware for mux framework which validating jwt token for RPC
Package rkmuxlog is a middleware for mux framework for logging RPC.
Package rkmuxlog is a middleware for mux framework for logging RPC.
Package rkmuxmeta is a middleware of mux framework for adding metadata in RPC response
Package rkmuxmeta is a middleware of mux framework for adding metadata in RPC response
Package rkmuxpanic is a middleware of mux framework for recovering from panic
Package rkmuxpanic is a middleware of mux framework for recovering from panic
Package rkmuxprom is a middleware for mux framework which record prometheus metrics for RPC
Package rkmuxprom is a middleware for mux framework which record prometheus metrics for RPC
Package rkmuxlimit is a middleware of mux framework for adding rate limit in RPC response
Package rkmuxlimit is a middleware of mux framework for adding rate limit in RPC response
Package rkmuxsec is a middleware of mux framework for adding secure headers in RPC response
Package rkmuxsec is a middleware of mux framework for adding secure headers in RPC response
Package rkmuxtrace is aa middleware of mux framework for recording trace info of RPC
Package rkmuxtrace is aa middleware of mux framework for recording trace info of RPC

Jump to

Keyboard shortcuts

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