Skip to content

Commit 2a30b23

Browse files
committed
Rename url variable
1 parent 991448d commit 2a30b23

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

coderd/coderd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ func New(options *Options) *API {
147147
// %40 is the encoded character of the @ symbol. VS Code Web does
148148
// not handle character encoding properly, so it's safe to assume
149149
// other applications might not as well.
150-
r.Route("/%40{user}/{workspacename_and_agent}/apps/{workspaceapp}", apps)
151-
r.Route("/@{user}/{workspacename_and_agent}/apps/{workspaceapp}", apps)
150+
r.Route("/%40{user}/{workspace_and_agent}/apps/{workspaceapp}", apps)
151+
r.Route("/@{user}/{workspace_and_agent}/apps/{workspaceapp}", apps)
152152

153153
r.Route("/api/v2", func(r chi.Router) {
154154
r.NotFound(func(rw http.ResponseWriter, r *http.Request) {

coderd/coderdtest/authtest.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ func NewAuthTester(ctx context.Context, t *testing.T, options *Options) *AuthTes
120120
require.NoError(t, err, "create template param")
121121

122122
urlParameters := map[string]string{
123-
"{organization}": admin.OrganizationID.String(),
124-
"{user}": admin.UserID.String(),
125-
"{organizationname}": organization.Name,
126-
"{workspace}": workspace.ID.String(),
127-
"{workspacebuild}": workspace.LatestBuild.ID.String(),
128-
"{workspacename}": workspace.Name,
129-
"{workspacebuildname}": workspace.LatestBuild.Name,
130-
"{workspaceagent}": workspaceResources[0].Agents[0].ID.String(),
131-
"{buildnumber}": strconv.FormatInt(int64(workspace.LatestBuild.BuildNumber), 10),
132-
"{template}": template.ID.String(),
133-
"{hash}": file.Hash,
134-
"{workspaceresource}": workspaceResources[0].ID.String(),
135-
"{workspaceapp}": workspaceResources[0].Agents[0].Apps[0].Name,
136-
"{templateversion}": version.ID.String(),
137-
"{jobID}": templateVersionDryRun.ID.String(),
138-
"{templatename}": template.Name,
139-
"{workspacename_and_agent}": workspace.Name + "." + workspaceResources[0].Agents[0].Name,
123+
"{organization}": admin.OrganizationID.String(),
124+
"{user}": admin.UserID.String(),
125+
"{organizationname}": organization.Name,
126+
"{workspace}": workspace.ID.String(),
127+
"{workspacebuild}": workspace.LatestBuild.ID.String(),
128+
"{workspacename}": workspace.Name,
129+
"{workspacebuildname}": workspace.LatestBuild.Name,
130+
"{workspaceagent}": workspaceResources[0].Agents[0].ID.String(),
131+
"{buildnumber}": strconv.FormatInt(int64(workspace.LatestBuild.BuildNumber), 10),
132+
"{template}": template.ID.String(),
133+
"{hash}": file.Hash,
134+
"{workspaceresource}": workspaceResources[0].ID.String(),
135+
"{workspaceapp}": workspaceResources[0].Agents[0].Apps[0].Name,
136+
"{templateversion}": version.ID.String(),
137+
"{jobID}": templateVersionDryRun.ID.String(),
138+
"{templatename}": template.Name,
139+
"{workspace_and_agent}": workspace.Name + "." + workspaceResources[0].Agents[0].Name,
140140
// Only checking template scoped params here
141141
"parameters/{scope}/{id}": fmt.Sprintf("parameters/%s/%s",
142142
string(templateParam.Scope), templateParam.ScopeID.String()),
@@ -406,11 +406,11 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
406406
}
407407
}
408408

409-
assertAllHTTPMethods("/%40{user}/{workspacename_and_agent}/apps/{workspaceapp}/*", RouteCheck{
409+
assertAllHTTPMethods("/%40{user}/{workspace_and_agent}/apps/{workspaceapp}/*", RouteCheck{
410410
AssertAction: rbac.ActionCreate,
411411
AssertObject: workspaceExecObj,
412412
})
413-
assertAllHTTPMethods("/@{user}/{workspacename_and_agent}/apps/{workspaceapp}/*", RouteCheck{
413+
assertAllHTTPMethods("/@{user}/{workspace_and_agent}/apps/{workspaceapp}/*", RouteCheck{
414414
AssertAction: rbac.ActionCreate,
415415
AssertObject: workspaceExecObj,
416416
})

coderd/httpmw/workspaceparam.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func ExtractWorkspaceParam(db database.Store) func(http.Handler) http.Handler {
5454
}
5555

5656
// ExtractWorkspaceAndAgentParam grabs a workspace and an agent from the
57-
// "workspacename_and_agent" URL parameter. `ExtractUserParam` must be called
57+
// "workspace_and_agent" URL parameter. `ExtractUserParam` must be called
5858
// before this.
5959
// This can be in the form of:
6060
// - "<workspace-name>.[workspace-agent]" : If multiple agents exist
@@ -63,7 +63,7 @@ func ExtractWorkspaceAndAgentParam(db database.Store) func(http.Handler) http.Ha
6363
return func(next http.Handler) http.Handler {
6464
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
6565
user := UserParam(r)
66-
workspaceWithAgent := chi.URLParam(r, "workspacename_and_agent")
66+
workspaceWithAgent := chi.URLParam(r, "workspace_and_agent")
6767
workspaceParts := strings.Split(workspaceWithAgent, ".")
6868

6969
workspace, err := db.GetWorkspaceByOwnerIDAndName(r.Context(), database.GetWorkspaceByOwnerIDAndNameParams{

coderd/httpmw/workspaceparam_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func TestWorkspaceAgentByNameParam(t *testing.T) {
296296
Agents: c.Agents,
297297
})
298298

299-
chi.RouteContext(r.Context()).URLParams.Add("workspacename_and_agent", c.URLParam)
299+
chi.RouteContext(r.Context()).URLParams.Add("workspace_and_agent", c.URLParam)
300300

301301
rtr := chi.NewRouter()
302302
rtr.Use(

0 commit comments

Comments
 (0)