mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: don't return 200 for deleted workspaces (#1556)
This commit is contained in:
+10
-1
@@ -42,7 +42,16 @@ type CreateWorkspaceBuildRequest struct {
|
||||
|
||||
// Workspace returns a single workspace.
|
||||
func (c *Client) Workspace(ctx context.Context, id uuid.UUID) (Workspace, error) {
|
||||
res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaces/%s", id), nil)
|
||||
return c.getWorkspace(ctx, id)
|
||||
}
|
||||
|
||||
// DeletedWorkspace returns a single workspace that was deleted.
|
||||
func (c *Client) DeletedWorkspace(ctx context.Context, id uuid.UUID) (Workspace, error) {
|
||||
return c.getWorkspace(ctx, id, queryParam("deleted", "true"))
|
||||
}
|
||||
|
||||
func (c *Client) getWorkspace(ctx context.Context, id uuid.UUID, opts ...requestOption) (Workspace, error) {
|
||||
res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaces/%s", id), nil, opts...)
|
||||
if err != nil {
|
||||
return Workspace{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user