mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-12 23:54:01 +09:00
test(observability-proxy): pin the refused forms of the bearer header
Parsing the scheme with a case-insensitive split changed which header forms reach the token review; a bare scheme, an empty token and a scheme run into the token must still answer 401. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
38f9837f14
commit
1004f2f2d8
1 file changed
+6
-4
@@ -464,10 +464,12 @@ func TestServerBearerSchemeCase(t *testing.T) {
|
||||
t.Errorf("Authorization %q answered %d, want 200", auth, resp.StatusCode)
|
||||
}
|
||||
}
|
||||
resp := h.do(http.MethodGet, logsRoot+"query", "", nil, map[string]string{"Authorization": "Basic good"})
|
||||
_ = resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusUnauthorized {
|
||||
t.Errorf("Basic scheme answered %d, want 401", resp.StatusCode)
|
||||
for _, auth := range []string{"Basic good", "Bearer", "Bearer ", "Bearergood"} {
|
||||
resp := h.do(http.MethodGet, logsRoot+"query", "", nil, map[string]string{"Authorization": auth})
|
||||
_ = resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusUnauthorized {
|
||||
t.Errorf("Authorization %q answered %d, want 401", auth, resp.StatusCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user