diff --git a/splitio/commitversion.go b/splitio/commitversion.go index ff47aa2b..0cd35ce1 100644 --- a/splitio/commitversion.go +++ b/splitio/commitversion.go @@ -5,4 +5,4 @@ This file is created automatically, please do not edit */ // CommitVersion is the version of the last commit previous to release -const CommitVersion = "8fd26d7" +const CommitVersion = "4f19e34" diff --git a/splitio/proxy/controllers/sdk_test.go b/splitio/proxy/controllers/sdk_test.go index 78284069..1f454602 100644 --- a/splitio/proxy/controllers/sdk_test.go +++ b/splitio/proxy/controllers/sdk_test.go @@ -53,7 +53,7 @@ func TestSplitChangesImpressionsDisabled(t *testing.T) { &rbsStorage, flagsets.NewMatcher(false, nil), &largeSegmentStorageMock, - specs.FLAG_V1_2, + specs.FLAG_V1_3, ) controller.Register(group) diff --git a/splitio/proxy/proxy.go b/splitio/proxy/proxy.go index 8a76e94c..da56dc9a 100644 --- a/splitio/proxy/proxy.go +++ b/splitio/proxy/proxy.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" + "github.com/splitio/split-synchronizer/v5/splitio" "github.com/splitio/split-synchronizer/v5/splitio/common/impressionlistener" "github.com/splitio/split-synchronizer/v5/splitio/proxy/controllers" "github.com/splitio/split-synchronizer/v5/splitio/proxy/controllers/middleware" @@ -145,6 +146,11 @@ func New(options *Options) *API { cacheableRouter.Use(options.Cache.Handle) cacheableRouter.Use(gzip.Gzip(gzip.DefaultCompression)) } + cacheableRouter.Use(func(c *gin.Context) { + c.Header("Harness-FME-Proxy-Version", splitio.Version) + c.Header("Harness-FME-FlagSpec", options.SpecVersion) + c.Next() + }) authController.Register(cacheableRouter) sdkController.Register(cacheableRouter) eventsController.Register(regular, beacon) diff --git a/splitio/proxy/proxy_test.go b/splitio/proxy/proxy_test.go index a2d63f97..bb39a674 100644 --- a/splitio/proxy/proxy_test.go +++ b/splitio/proxy/proxy_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/splitio/split-synchronizer/v5/splitio" ilmock "github.com/splitio/split-synchronizer/v5/splitio/common/impressionlistener/mocks" "github.com/splitio/split-synchronizer/v5/splitio/proxy/caching" "github.com/splitio/split-synchronizer/v5/splitio/proxy/storage" @@ -79,7 +80,8 @@ func TestSplitChangesEndpoints(t *testing.T) { assert.Equal(t, "split2", changes.Splits[0].Name) assert.False(t, changes.Splits[0].ImpressionsDisabled) assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type")) - + assert.Equal(t, opts.SpecVersion, headers.Get("Harness-FME-FlagSpec")) + assert.Equal(t, splitio.Version, headers.Get("Harness-FME-Proxy-Version")) } func TestSplitChangesWithFlagsetsCaching(t *testing.T) { @@ -160,6 +162,8 @@ func TestSplitChangesWithFlagsetsCaching(t *testing.T) { assert.Equal(t, int64(1), changes.Till) assert.Equal(t, "split1", changes.Splits[0].Name) assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type")) + assert.Equal(t, opts.SpecVersion, headers.Get("Harness-FME-FlagSpec")) + assert.Equal(t, splitio.Version, headers.Get("Harness-FME-Proxy-Version")) } func TestSegmentChangesAndMySegmentsEndpoints(t *testing.T) { @@ -249,6 +253,8 @@ func TestSegmentChangesAndMySegmentsEndpoints(t *testing.T) { assert.Equal(t, 200, status) assert.Equal(t, []dtos.MySegmentDTO{}, segments) assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type")) + assert.Equal(t, opts.SpecVersion, headers.Get("Harness-FME-FlagSpec")) + assert.Equal(t, splitio.Version, headers.Get("Harness-FME-Proxy-Version")) } func TestMembershipEndpoint(t *testing.T) { @@ -284,6 +290,8 @@ func TestMembershipEndpoint(t *testing.T) { assert.Equal(t, 200, status) assert.Equal(t, expected, response) assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type")) + assert.Equal(t, opts.SpecVersion, headers.Get("Harness-FME-FlagSpec")) + assert.Equal(t, splitio.Version, headers.Get("Harness-FME-Proxy-Version")) } func makeOpts() *Options {