WorkspaceAgentAndWorkspaceParam returns the workspace agent and its associated workspace from the ExtractWorkspaceAgentParam handler.
(r *http.Request)
| 17 | |
| 18 | // WorkspaceAgentAndWorkspaceParam returns the workspace agent and its associated workspace from the ExtractWorkspaceAgentParam handler. |
| 19 | func 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. |
| 28 | func ExtractWorkspaceAgentAndWorkspaceParam(db database.Store) func(http.Handler) http.Handler { |