context

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxBodyKey is the context key for the body
	CtxBodyKey = "body"
)

Variables

View Source
var (
	ErrMissingBodyInContext = errors.New("missing body in context")
)

Functions

func GetCtxBody

func GetCtxBody(r *http.Request) interface{}

GetCtxBody tries to get the body from the context

Parameters:

  • r: The HTTP request

Returns:

  • interface{}: The body from the context, or nil if not found

func SetCtxBody

func SetCtxBody(r *http.Request, body interface{}) *http.Request

SetCtxBody sets the body in the context

Parameters:

  • r: The HTTP request
  • body: The body to set in the context

Returns:

  • *http.Request: The HTTP request with the body set in the context

Types

This section is empty.

Jump to

Keyboard shortcuts

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