WorkspaceParam returns the workspace from the ExtractWorkspaceParam handler.
(r *http.Request)
| 15 | |
| 16 | // WorkspaceParam returns the workspace from the ExtractWorkspaceParam handler. |
| 17 | func WorkspaceParam(r *http.Request) database.Workspace { |
| 18 | workspace, ok := r.Context().Value(workspaceParamContextKey{}).(database.Workspace) |
| 19 | if !ok { |
| 20 | panic("developer error: workspace param middleware not provided") |
| 21 | } |
| 22 | return workspace |
| 23 | } |
| 24 | |
| 25 | // ExtractWorkspaceParam grabs a workspace from the "workspace" URL parameter. |
| 26 | func ExtractWorkspaceParam(db database.Store) func(http.Handler) http.Handler { |