request

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetProxyHeaders

func SetProxyHeaders(r *http.Request)

SetProxyHeaders sets the proxy headers in the request.

func WithInfo

func WithInfo(ctx context.Context, info *Info) context.Context

WithInfo adds the Info to the context.

Types

type Info

type Info struct {
	// contains filtered or unexported fields
}

Info stores request information in the context.

func InfoFromContext added in v1.8.8

func InfoFromContext(ctx context.Context) (*Info, bool)

InfoFromContext retrieves the Info from the context.

func NewInfo

func NewInfo(r *http.Request) *Info

NewInfo creates a new Info instance with the provided values.

func (*Info) InstallationID added in v1.11.7

func (i *Info) InstallationID() int64

InstallationID returns the authenticated installation ID.

func (*Info) InstallationURL added in v1.11.7

func (i *Info) InstallationURL() string

InstallationURL returns the authenticated installation URL.

func (*Info) RemoteHeader added in v1.25.0

func (i *Info) RemoteHeader(name string) string

RemoteHeader returns a header value from the original inbound request (cloned in NewInfo), or "" if absent. Useful for debugging header forwarding — e.g. comparing what a client sent against what is forwarded.

func (*Info) SetAuth added in v1.11.7

func (i *Info) SetAuth(installationID int64, installationURL string, userID int64)

SetAuth sets the authenticated information.

func (*Info) TraceID added in v1.8.8

func (i *Info) TraceID() string

TraceID returns the request trace ID.

func (*Info) UserID added in v1.11.7

func (i *Info) UserID() int64

UserID returns the authenticated user ID.

type ResponseWriter added in v1.8.8

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter is a custom http.ResponseWriter that captures the status code and response body.

It deliberately implements http.Flusher and Unwrap so that http.ResponseController can reach the flusher of the wrapped writer. The MCP SDK writes Server-Sent Events through http.ResponseController: without these methods flushing silently becomes a no-op and clients waiting on the stream receive nothing until the handler returns.

func NewResponseWriter added in v1.8.8

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

NewResponseWriter creates a new ResponseWriter.

func (*ResponseWriter) Body added in v1.8.8

func (w *ResponseWriter) Body() []byte

Body returns the captured response body. Bodies larger than maxCapturedBodySize are truncated and marked as such.

func (*ResponseWriter) Flush added in v1.26.0

func (w *ResponseWriter) Flush()

Flush forwards the flush to the wrapped writer, when it supports it. This keeps Server-Sent Events streams responsive while still being logged.

func (*ResponseWriter) StatusCode added in v1.8.8

func (w *ResponseWriter) StatusCode() int

StatusCode returns the captured status code.

func (*ResponseWriter) Unwrap added in v1.26.0

func (w *ResponseWriter) Unwrap() http.ResponseWriter

Unwrap returns the wrapped http.ResponseWriter, allowing http.ResponseController to reach optional interfaces (flushing, hijacking, deadlines) implemented further down the chain.

func (*ResponseWriter) Write added in v1.8.8

func (w *ResponseWriter) Write(b []byte) (int, error)

Write captures the response body, up to maxCapturedBodySize, and forwards it to the wrapped writer.

func (*ResponseWriter) WriteHeader added in v1.8.8

func (w *ResponseWriter) WriteHeader(code int)

WriteHeader captures the status code.

Jump to

Keyboard shortcuts

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