mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
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:
@ -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
|
||||||
|
@ -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")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user