mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
fix: accept agent RPC connection without version query parameter (#11790)
Fixes an issue where Coder v2.7.1 agents connect to /api/v2/workspaceagents/me/rpc without a version query parameter
This commit is contained in:
@ -40,10 +40,10 @@ func (api *API) workspaceAgentRPC(rw http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
version := r.URL.Query().Get("version")
|
version := r.URL.Query().Get("version")
|
||||||
if version == "" {
|
if version == "" {
|
||||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
// The initial version on this HTTP endpoint was 2.0, so assume this version if unspecified.
|
||||||
Message: "Missing required query parameter: version",
|
// Coder v2.7.1 (not to be confused with the Agent API version) calls this endpoint without
|
||||||
})
|
// a version parameter and wants Agent API version 2.0.
|
||||||
return
|
version = "2.0"
|
||||||
}
|
}
|
||||||
if err := proto.CurrentVersion.Validate(version); err != nil {
|
if err := proto.CurrentVersion.Validate(version); err != nil {
|
||||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||||
|
Reference in New Issue
Block a user