Skip to content

Commit 68aca7d

Browse files
authored
fix decide reasons issue for variables and reasons in fsc PR 495. (#309)
1 parent 3e63d62 commit 68aca7d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/client/optimizely_decision.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2020, Optimizely, Inc. and contributors *
2+
* Copyright 2020-2021, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -50,7 +50,7 @@ func NewErrorDecision(key string, user OptimizelyUserContext, err error) Optimiz
5050
return OptimizelyDecision{
5151
FlagKey: key,
5252
UserContext: user,
53-
Variables: &optimizelyjson.OptimizelyJSON{},
53+
Variables: optimizelyjson.NewOptimizelyJSONfromMap(map[string]interface{}{}),
5454
Reasons: []string{err.Error()},
5555
}
5656
}

pkg/client/optimizely_decision_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2020, Optimizely, Inc. and contributors *
2+
* Copyright 2020-2021, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -67,7 +67,7 @@ func (s *OptimizelyDecisionTestSuite) TestNewErrorDecision() {
6767

6868
s.Equal("", decision.VariationKey)
6969
s.Equal(false, decision.Enabled)
70-
s.Equal(&optimizelyjson.OptimizelyJSON{}, decision.Variables)
70+
s.Equal(optimizelyjson.NewOptimizelyJSONfromMap(map[string]interface{}{}), decision.Variables)
7171
s.Equal("", decision.RuleKey)
7272
s.Equal(flagKey, decision.FlagKey)
7373
s.Equal(1, len(decision.Reasons))

pkg/decide/decide_errors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2020, Optimizely, Inc. and contributors *
2+
* Copyright 2020-2021, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -34,10 +34,10 @@ const (
3434

3535
// GetDecideMessage returns message for decide type
3636
func GetDecideMessage(messageType decideMessage, arguments ...interface{}) string {
37-
return fmt.Sprintf(string(messageType), arguments)
37+
return fmt.Sprintf(string(messageType), arguments...)
3838
}
3939

4040
// GetDecideError returns error for decide type
4141
func GetDecideError(messageType decideMessage, arguments ...interface{}) error {
42-
return fmt.Errorf(string(messageType), arguments)
42+
return fmt.Errorf(string(messageType), arguments...)
4343
}

0 commit comments

Comments
 (0)