|
|
|
@ -75,6 +75,20 @@ func TestPluginProxy(t *testing.T) { |
|
|
|
|
So(req.Header.Get("X-Grafana-User"), ShouldEqual, "") |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
Convey("When SendUserHeader config is enabled but user is anonymous", t, func() { |
|
|
|
|
req := getPluginProxiedRequest( |
|
|
|
|
&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, "") |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// getPluginProxiedRequest is a helper for easier setup of tests based on global config and ReqContext.
|
|
|
|
|