mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove middleware to request version and entitlement warnings (#12750)
This cleans up `root.go` a bit, adds tests for middleware HTTP transport functions, and removes two HTTP requests we always always performed previously when executing *any* client command. It should improve CLI performance (especially for users with higher latency).
This commit is contained in:
+4
-1
@@ -81,6 +81,9 @@ const (
|
||||
|
||||
// BuildVersionHeader contains build information of Coder.
|
||||
BuildVersionHeader = "X-Coder-Build-Version"
|
||||
|
||||
// EntitlementsWarnings contains active warnings for the user's entitlements.
|
||||
EntitlementsWarningHeader = "X-Coder-Entitlements-Warning"
|
||||
)
|
||||
|
||||
// loggableMimeTypes is a list of MIME types that are safe to log
|
||||
@@ -358,7 +361,7 @@ func ReadBodyAsError(res *http.Response) error {
|
||||
if res.StatusCode == http.StatusUnauthorized {
|
||||
// 401 means the user is not logged in
|
||||
// 403 would mean that the user is not authorized
|
||||
helpMessage = "Try logging in using 'coder login <url>'."
|
||||
helpMessage = "Try logging in using 'coder login'."
|
||||
}
|
||||
|
||||
resp, err := io.ReadAll(res.Body)
|
||||
|
||||
Reference in New Issue
Block a user