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

Method Normalize

coderd/workspaceapps/request.go:107–124  ·  view source on GitHub ↗

Normalize replaces WorkspaceAndAgent with WorkspaceNameOrID and AgentNameOrID. This must be called before Validate.

()

Source from the content-addressed store, hash-verified

105// Normalize replaces WorkspaceAndAgent with WorkspaceNameOrID and
106// AgentNameOrID. This must be called before Validate.
107func (r Request) Normalize() Request {
108 req := r
109 if req.WorkspaceAndAgent != "" {
110 // workspace.agent
111 workspaceAndAgent := strings.SplitN(req.WorkspaceAndAgent, ".", 2)
112 req.WorkspaceAndAgent = ""
113 req.WorkspaceNameOrID = workspaceAndAgent[0]
114 if len(workspaceAndAgent) > 1 {
115 req.AgentNameOrID = workspaceAndAgent[1]
116 }
117 }
118
119 if !strings.HasSuffix(req.BasePath, "/") {
120 req.BasePath += "/"
121 }
122
123 return req
124}
125
126// Check ensures the request is correct and contains the necessary
127// parameters.

Callers 7

ResolveRequestFunction · 0.80
IssueMethod · 0.80
Test_ResolveRequestFunction · 0.80
Test_RequestValidateFunction · 0.80
FromRequestFunction · 0.80
buildToolDefinitionsFunction · 0.80
IssueMethod · 0.80

Calls

no outgoing calls

Tested by 2

Test_ResolveRequestFunction · 0.64
Test_RequestValidateFunction · 0.64