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

Function WorkspaceAgentAndWorkspaceParam

coderd/httpmw/workspaceagentparam.go:19–25  ·  view source on GitHub ↗

WorkspaceAgentAndWorkspaceParam returns the workspace agent and its associated workspace from the ExtractWorkspaceAgentParam handler.

(r *http.Request)

Source from the content-addressed store, hash-verified

17
18// WorkspaceAgentAndWorkspaceParam returns the workspace agent and its associated workspace from the ExtractWorkspaceAgentParam handler.
19func WorkspaceAgentAndWorkspaceParam(r *http.Request) database.GetWorkspaceAgentAndWorkspaceByIDRow {
20 aw, ok := r.Context().Value(workspaceAgentAndWorkspaceParamContextKey{}).(database.GetWorkspaceAgentAndWorkspaceByIDRow)
21 if !ok {
22 panic("developer error: agent middleware not provided")
23 }
24 return aw
25}
26
27// ExtractWorkspaceAgentAndWorkspaceParam grabs a workspace agent and its associated workspace from the "workspaceagent" URL parameter.
28func ExtractWorkspaceAgentAndWorkspaceParam(db database.Store) func(http.Handler) http.Handler {

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by 1

TestWorkspaceAgentParamFunction · 0.74