MCPcopy Index your code
hub / github.com/coder/coder / extractContextForTest

Function extractContextForTest

agent/agentchat/headers_test.go:143–153  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

141}
142
143func extractContextForTest(r *http.Request) (uuid.UUID, []uuid.UUID, bool) {
144 var chatContext agentchat.Context
145 var ok bool
146 agentchat.Middleware(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
147 chatContext, ok = agentchat.FromContext(r.Context())
148 })).ServeHTTP(httptest.NewRecorder(), r)
149 if !ok {
150 return uuid.Nil, nil, false
151 }
152 return chatContext.ID, chatContext.AncestorIDs, true
153}
154
155// mustMarshalJSON marshals v to a JSON string, failing the test on error.
156func mustMarshalJSON(t *testing.T, v any) string {

Callers 1

TestExtractContextFunction · 0.85

Calls 4

MiddlewareFunction · 0.92
FromContextFunction · 0.92
ContextMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected