httpwrap

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReqWrap

func NewReqWrap(
	r *http.Request, maxRequestBodySize int64,
) (*defaultReqWrap, error)

NewReqWrap creates a new defaultResWrap instance and captures the request body, enforcing a maximum size to prevent excessive memory usage. If the request body is larger than the maximum size, an error is returned.

Parameters:

  • r: The original http.Request.

Returns:

  • *defaultReqWrap: A new defaultReqWrap instance.
  • error: Any error encountered during body reading.

func NewResWrap

func NewResWrap(w http.ResponseWriter) *defaultResWrap

NewResWrap creates a new &defaultResWrap instance wrapping the given http.ResponseWriter.

Parameters:

  • w: The original http.ResponseWriter.

Returns:

  • *defaultResWrap: A new defaultResWrap instance.

Types

type ReqWrap

type ReqWrap interface {
	GetRequest() *http.Request
	GetBody() []byte
}

type ResWrap

type ResWrap interface {
	http.ResponseWriter
	StatusCode() int
	Header() http.Header
	WriteHeader(statusCode int)
	Body() []byte
	Write(data []byte) (int, error)
	Flush()
	Hijack() (net.Conn, *bufio.ReadWriter, error)
}

Jump to

Keyboard shortcuts

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