MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / withRawRequest

Function withRawRequest

internal/httpapi/httpapi.go:387–392  ·  view source on GitHub ↗

withRawRequest stashes the request so Huma handlers can recover it for the auth path. Storing the request in its own derived context is the standard bridge; only headers/cookies are read downstream, so the pre-derivation request is equivalent for authentication.

(next http.Handler)

Source from the content-addressed store, hash-verified

385// standard bridge; only headers/cookies are read downstream, so the
386// pre-derivation request is equivalent for authentication.
387func withRawRequest(next http.Handler) http.Handler {
388 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
389 ctx := context.WithValue(r.Context(), reqCtxKey{}, r)
390 next.ServeHTTP(w, r.WithContext(ctx))
391 })
392}
393
394// RequestFromContext recovers the raw request stashed by withRawRequest.
395func RequestFromContext(ctx context.Context) *http.Request {

Callers

nothing calls this directly

Calls 1

ServeHTTPMethod · 0.45

Tested by

no test coverage detected