Commit d717515
fix: serialize booleans as native JSON in precomputed request body (#243)
* fix: serialize booleans as native JSON in precomputed request body
The buildRequestBody() method was converting all non-numeric attribute
values to strings, including booleans. This caused boolean attributes
like "isPremium: true" to be sent as "isPremium: \"true\"" (string)
instead of "isPremium: true" (native JSON boolean).
This fix aligns the Android SDK with the JS and iOS SDKs, which preserve
native boolean types in the wire format.
Changes:
- Add ContextAttributesSerializer utility for consistent serialization
- Properly handle booleans as native JSON booleans in categorical attrs
- Exclude null values from serialization (matching JS/iOS behavior)
- Add comprehensive unit tests for wire format verification
- Add precomputed-v1.json test data for integration tests
* chore: remove test data file, use make test-data instead
The precomputed-v1.json file should be fetched via `make test-data`
rather than committed to the repository.
* chore: bump version to 4.12.1
* Update eppo/src/test/java/cloud/eppo/android/ContextAttributesSerializerTest.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* test: add explicit null-valued attribute tests
Cover both EppoValue.nullValue() and Java null in the attributes map
to document that both are excluded from serialization output.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent ff5b1a2 commit d717515
4 files changed
Lines changed: 330 additions & 43 deletions
File tree
- eppo
- src
- main/java/cloud/eppo/android
- util
- test/java/cloud/eppo/android
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 4 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
645 | 646 | | |
646 | 647 | | |
647 | 648 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
| 649 | + | |
669 | 650 | | |
670 | 651 | | |
671 | 652 | | |
| |||
674 | 655 | | |
675 | 656 | | |
676 | 657 | | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
| 658 | + | |
| 659 | + | |
698 | 660 | | |
699 | 661 | | |
700 | 662 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
0 commit comments