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

Function WorkspaceAgentOptional

coderd/httpmw/workspaceagent.go:21–24  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

19type workspaceAgentContextKey struct{}
20
21func WorkspaceAgentOptional(r *http.Request) (database.WorkspaceAgent, bool) {
22 user, ok := r.Context().Value(workspaceAgentContextKey{}).(database.WorkspaceAgent)
23 return user, ok
24}
25
26// WorkspaceAgent returns the workspace agent from the ExtractAgent handler.
27func WorkspaceAgent(r *http.Request) database.WorkspaceAgent {

Callers 2

WorkspaceAgentFunction · 0.85

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by

no test coverage detected