request

package
v2.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package request provides functionality for handling HTTP Requests including the insertion of configuration options into the request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearResources

func ClearResources(r *http.Request) *http.Request

ClearResources removes Resources from the HTTP Request's context

func Clone

func Clone(r *http.Request) (*http.Request, error)

Clone wraps the builtin Clone to use a deep clone of both the request body reader (when present) and the Trickster context data

func GetBody

func GetBody(r *http.Request, maxSize ...int64) ([]byte, error)

func GetBodyReader

func GetBodyReader(r *http.Request) (io.ReadCloser, error)

func SetBody

func SetBody(r *http.Request, body []byte)

func SetResources

func SetResources(r *http.Request, rsc *Resources) *http.Request

SetResources will save the Resources collection to the HTTP Request's context

Types

type Resources

type Resources struct {
	sync.Mutex
	BackendOptions    *bo.Options
	PathConfig        *po.Options
	CacheConfig       *co.Options
	NoLock            bool
	CacheClient       cache.Cache
	BackendClient     backends.Backend
	AlternateCacheTTL time.Duration
	TimeRangeQuery    *timeseries.TimeRangeQuery
	Tracer            *tracing.Tracer
	IsMergeMember     bool
	RequestBody       []byte
	MergeFunc         merge.MergeFunc
	MergeRespondFunc  merge.RespondFunc
	TSUnmarshaler     timeseries.UnmarshalerFunc
	TSMarshaler       timeseries.MarshalWriterFunc
	TSTransformer     func(timeseries.Timeseries)
	TS                timeseries.Timeseries
	TSReqestOptions   *timeseries.RequestOptions
	Response          *http.Response
	AuthResult        *auth.AuthResult
	AlreadyEncoded    bool
	Cancelable        bool
}

Resources is a collection of resources a Trickster request would need to fulfill the client request This is stored in the client request's context for use by request handers.

func GetResources

func GetResources(r *http.Request) *Resources

GetResources will return a casted Resource object from the HTTP Request's context

func NewResources

func NewResources(oo *bo.Options, pathOpts *po.Options, cacheOpts *co.Options,
	c cache.Cache, client backends.Backend, t *tracing.Tracer,
) *Resources

NewResources returns a new Resources collection based on the provided inputs

func (*Resources) Clone

func (r *Resources) Clone() *Resources

Clone returns an exact copy of the subject Resources collection

func (*Resources) Merge

func (r *Resources) Merge(r2 *Resources)

Merge sets the configuration references in the subject resources to the source's

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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