func TestContextMustReader(t *testing.T) { mr := config.NewMockReader() ctx := config.NewContextReader(context.Background(), mr) mrHave := config.FromContextReader(ctx) assert.Exactly(t, mr, mrHave) ctx = config.NewContextReader(context.Background(), nil) mrHave = config.FromContextReader(ctx) assert.Exactly(t, config.DefaultManager, mrHave) }
// CtxIsSecure same as IsSecure() but extract the config.Reader out of the context. // Wrapper function. func CtxIsSecure(ctx context.Context, r *http.Request) bool { return IsSecure(config.FromContextReader(ctx), r) }