Skip to content

Commit f7c703e

Browse files
committed
empty endpoint
1 parent 8c770ff commit f7c703e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

coderd/coderd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ func New(options *Options) *API {
562562
r.Get("/", api.templateVersion)
563563
r.Patch("/", api.patchTemplateVersion)
564564
r.Patch("/cancel", api.patchCancelTemplateVersion)
565+
// Old agents may expect a non-error response from /schema and /parameters endpoints.
566+
// The idea is to return an empty [], so that the coder CLI won't get blocked accidentally.
567+
r.Get("/schema", api.deprecatedEmptySlice)
568+
r.Get("/parameters", api.deprecatedEmptySlice)
565569
r.Get("/rich-parameters", api.templateVersionRichParameters)
566570
r.Get("/gitauth", api.templateVersionGitAuth)
567571
r.Get("/variables", api.templateVersionVariables)

coderd/deprecated.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package coderd
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/coder/coder/coderd/httpapi"
7+
)
8+
9+
func (api *API) deprecatedEmptySlice(rw http.ResponseWriter, r *http.Request) {
10+
httpapi.Write(r.Context(), rw, http.StatusOK, []struct{}{})
11+
}

0 commit comments

Comments
 (0)