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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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