Commit 923c81f
committed
JSON-escape and percent-encode string elements
Encode string list elements by JSON-escaping then percent-encoding so quotes, backslashes and newlines remain valid in the server-decoded JSON, while characters like &, =, +, and # are protected from querystring parsing. Introduces _encodeStringElement (uses jsonEncode then Uri.encodeComponent) and updates _encodeStringElements to use it. Tests updated: stricter List<String>/List<int> typing, added a test to verify JSON-escaping of quotes and backslashes, and adjusted existing expectations for encoded delimiters.1 parent a7d50cf commit 923c81f
2 files changed
Lines changed: 43 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
326 | 335 | | |
327 | 336 | | |
328 | | - | |
| 337 | + | |
329 | 338 | | |
330 | 339 | | |
331 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
703 | 702 | | |
704 | 703 | | |
705 | | - | |
706 | | - | |
| 704 | + | |
707 | 705 | | |
708 | 706 | | |
709 | 707 | | |
710 | | - | |
711 | | - | |
| 708 | + | |
| 709 | + | |
712 | 710 | | |
713 | | - | |
714 | 711 | | |
715 | 712 | | |
716 | 713 | | |
| |||
722 | 719 | | |
723 | 720 | | |
724 | 721 | | |
725 | | - | |
726 | | - | |
| 722 | + | |
| 723 | + | |
727 | 724 | | |
728 | 725 | | |
729 | 726 | | |
730 | 727 | | |
731 | 728 | | |
732 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
733 | 752 | | |
734 | | - | |
735 | 753 | | |
736 | 754 | | |
737 | | - | |
738 | | - | |
| 755 | + | |
739 | 756 | | |
740 | | - | |
741 | 757 | | |
742 | 758 | | |
743 | 759 | | |
| |||
0 commit comments