@@ -28,8 +28,9 @@ func Test_CollectDataAPI(t *testing.T) {
28
28
name : "Valid api call" ,
29
29
wantErr : assert .NoError ,
30
30
options : controller.GoFeatureFlagApiOptions {
31
- Endpoint : "http://localhost:1031" ,
32
- APIKey : "" ,
31
+ Endpoint : "http://localhost:1031" ,
32
+ APIKey : "" ,
33
+ ExporterMetadata : map [string ]interface {}{"openfeature" : true , "provider" : "go" },
33
34
},
34
35
events : []model.FeatureEvent {
35
36
{
@@ -68,14 +69,15 @@ func Test_CollectDataAPI(t *testing.T) {
68
69
headers .Set (controller .ContentTypeHeader , controller .ApplicationJson )
69
70
return headers
70
71
}(),
71
- wantReqBody : "{\" events\" :[{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" ABCD\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" },{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" EFGH\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" }],\" meta\" :{\" openfeature\" :\" true\" ,\" provider\" :\" go\" }}" ,
72
+ wantReqBody : "{\" events\" :[{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" ABCD\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" },{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" EFGH\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" }],\" meta\" :{\" openfeature\" :true,\" provider\" :\" go\" }}" ,
72
73
},
73
74
{
74
75
name : "Valid api call with API Key" ,
75
76
wantErr : assert .NoError ,
76
77
options : controller.GoFeatureFlagApiOptions {
77
- Endpoint : "http://localhost:1031" ,
78
- APIKey : "my-key" ,
78
+ Endpoint : "http://localhost:1031" ,
79
+ APIKey : "my-key" ,
80
+ ExporterMetadata : map [string ]interface {}{"openfeature" : true , "provider" : "go" },
79
81
},
80
82
events : []model.FeatureEvent {
81
83
{
@@ -115,7 +117,7 @@ func Test_CollectDataAPI(t *testing.T) {
115
117
headers .Set (controller .AuthorizationHeader , controller .BearerPrefix + "my-key" )
116
118
return headers
117
119
}(),
118
- wantReqBody : "{\" events\" :[{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" ABCD\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" },{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" EFGH\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" }],\" meta\" :{\" openfeature\" :\" true\" ,\" provider\" :\" go\" }}" ,
120
+ wantReqBody : "{\" events\" :[{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" ABCD\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" },{\" kind\" :\" feature\" ,\" contextKind\" :\" user\" ,\" userKey\" :\" EFGH\" ,\" creationDate\" :1722266324,\" key\" :\" random-key\" ,\" variation\" :\" variationA\" ,\" value\" :\" YO\" ,\" default\" :false,\" version\" :\" \" ,\" source\" :\" SERVER\" }],\" meta\" :{\" openfeature\" :true,\" provider\" :\" go\" }}" ,
119
121
},
120
122
{
121
123
name : "Request failed" ,
0 commit comments