Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RELEASE_SIGNING_ENABLED=true

GROUP=com.statsig.serversdk
POM_ARTIFACT_ID=serversdk
VERSION_NAME=1.2.0
VERSION_NAME=1.2.1

POM_NAME=Statsig Server SDK
POM_DESCRIPTION=A feature gating and a/b testing library for statsig
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/statsig/sdk/StatsigMetadata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.statsig.sdk

import java.util.Properties

private const val VERSION = "1.2.0"
private const val VERSION = "1.2.1"

internal class StatsigMetadata {
companion object {
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/com/statsig/sdk/StatsigServer.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.statsig.sdk

import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.ToNumberPolicy
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
Expand Down Expand Up @@ -171,6 +173,8 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
}
}

private val gson = GsonBuilder().setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE).create()

override val errorBoundary = ErrorBoundary(serverSecret, options)
private val coroutineExceptionHandler =
CoroutineExceptionHandler { _, ex ->
Expand Down Expand Up @@ -204,7 +208,7 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
return
}
try {
val configString = configSpecs.toString()
val configString = gson.toJson(configSpecs)
options.rulesUpdatedCallback?.accept(configString)
} catch (e: Exception) {}
}
Expand Down
8 changes: 7 additions & 1 deletion src/test/java/com/statsig/sdk/StatsigE2ETest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ class StatsigE2ETest {
bootstrapValues = downloadConfigSpecsResponse,
rulesUpdatedCallback = {
bootstrap_callback_count++
val specs = gson.fromJson(it, APIDownloadedConfigs::class.java)
assert(gson.toJson(specs) == gson.toJson(gson.fromJson(downloadConfigSpecsResponse, APIDownloadedConfigs::class.java)))
}
).apply {
api = server.url("/v1").toString()
Expand All @@ -385,7 +387,11 @@ class StatsigE2ETest {
} else {
options = StatsigOptions(
bootstrapValues = downloadConfigSpecsResponse,
rulesUpdatedCallback = { bootstrap_callback_count++ }
rulesUpdatedCallback = {
bootstrap_callback_count++
val specs = gson.fromJson(it, APIDownloadedConfigs::class.java)
assert(gson.toJson(specs) == gson.toJson(gson.fromJson(downloadConfigSpecsResponse, APIDownloadedConfigs::class.java)))
}
).apply {
api = server.url("/v1").toString()
}
Expand Down