chore: Deprecate old cookie value (#4336)

Older clis will need to be updated.
Modern clis cannot communicate with <8.15 coderd
This commit is contained in:
Steven Masley
2022-10-03 13:04:22 -04:00
committed by GitHub
parent 4f6355506c
commit 0a95ba62b1
2 changed files with 0 additions and 15 deletions

View File

@ -380,14 +380,6 @@ func apiTokenFromRequest(r *http.Request) string {
return cookie.Value return cookie.Value
} }
// TODO: @emyrk in October 2022, remove this oldCookie check.
// This is just to support the old cli for 1 release. Then everyone
// must update.
oldCookie, err := r.Cookie("session_token")
if err == nil && oldCookie.Value != "" {
return oldCookie.Value
}
urlValue := r.URL.Query().Get(codersdk.SessionTokenKey) urlValue := r.URL.Query().Get(codersdk.SessionTokenKey)
if urlValue != "" { if urlValue != "" {
return urlValue return urlValue

View File

@ -83,13 +83,6 @@ func (c *Client) Request(ctx context.Context, method, path string, body interfac
} }
req.Header.Set(SessionCustomHeader, c.SessionToken) req.Header.Set(SessionCustomHeader, c.SessionToken)
// Delete this custom cookie set in November 2022. This is just to remain
// backwards compatible with older versions of Coder.
req.AddCookie(&http.Cookie{
Name: "session_token",
Value: c.SessionToken,
})
if body != nil { if body != nil {
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
} }