Add check so that header is not sent for anonymous users
This commit is contained in:
1 parent
6587a967eb
commit
697a87b7b2
7 files changed
+32
-5
No files matched your search
@@ -417,6 +417,19 @@ func TestDSRouteRule(t *testing.T) {
|
||||
So(req.Header.Get("X-Grafana-User"), ShouldEqual, "")
|
||||
})
|
||||
})
|
||||
|
||||
Convey("When SendUserHeader config is enabled but user is anonymous", func() {
|
||||
req := getDatasourceProxiedRequest(
|
||||
&m.ReqContext{
|
||||
SignedInUser: &m.SignedInUser{IsAnonymous: true},
|
||||
},
|
||||
&setting.Cfg{SendUserHeader: true},
|
||||
)
|
||||
Convey("Should not add header with username", func() {
|
||||
// Get will return empty string even if header is not set
|
||||
So(req.Header.Get("X-Grafana-User"), ShouldEqual, "")
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user