Skip to content

Commit

Permalink
fixing splitChanges endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sanzmauro committed Nov 29, 2024
1 parent 86d6ad3 commit 1433b8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions splitio/proxy/conf/sections.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (m *Main) BuildAdvancedConfig() *cconf.AdvancedConfig {
tmp.SegmentsRefreshRate = int(m.Sync.SegmentRefreshRateMs / 1000)
tmp.LargeSegment.LazyLoad = m.Sync.Advanced.LargeSegmentLazyLoad
tmp.LargeSegment.RefreshRate = int(m.Sync.LargeSegmentRefreshRateMs / 1000)
tmp.LargeSegment.Version = m.LargeSegmentVersion
return tmp
}

Expand Down
10 changes: 7 additions & 3 deletions splitio/proxy/controllers/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ func (c *SdkServerController) SplitChanges(ctx *gin.Context) {
return
}

spec, _ := ctx.GetQuery("s")
if spec != specs.FLAG_V1_1 {
spec = specs.FLAG_V1_0
sParam, _ := ctx.GetQuery("s")
spec, err := specs.ParseAndValidate(sParam)
if err != nil {
c.logger.Error(fmt.Sprintf("error getting split changes: %s.", err))
ctx.JSON(http.StatusBadRequest, gin.H{"code": 400, "message": err.Error()})
return
}

splits.Splits = c.patchUnsupportedMatchers(splits.Splits, spec)

ctx.JSON(http.StatusOK, splits)
Expand Down

0 comments on commit 1433b8f

Please sign in to comment.