Skip to content

Commit

Permalink
🐛 disable decodeDotInKeys by default to restore previous behavior (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse authored Apr 13, 2024
1 parent 67357be commit 8650854
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/models/decode_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class DecodeOptions with EquatableMixin {
this.parseLists = true,
this.strictNullHandling = false,
}) : allowDots = allowDots ?? decodeDotInKeys == true || false,
decodeDotInKeys = decodeDotInKeys ?? true,
decodeDotInKeys = decodeDotInKeys ?? false,
_decoder = decoder,
assert(
charset == utf8 || charset == latin1,
Expand Down
20 changes: 20 additions & 0 deletions test/unit/decode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,26 @@ void main() {
'name.obj.subobject': {'first.godly.name': 'John', 'last': 'Doe'}
}),
);
expect(
QS.decode('name%252Eobj.first=John&name%252Eobj.last=Doe'),
equals({'name%2Eobj.first': 'John', 'name%2Eobj.last': 'Doe'}),
);
expect(
QS.decode(
'name%252Eobj.first=John&name%252Eobj.last=Doe',
const DecodeOptions(decodeDotInKeys: false),
),
equals({'name%2Eobj.first': 'John', 'name%2Eobj.last': 'Doe'}),
);
expect(
QS.decode(
'name%252Eobj.first=John&name%252Eobj.last=Doe',
const DecodeOptions(decodeDotInKeys: true),
),
equals({
'name.obj': {'first': 'John', 'last': 'Doe'}
}),
);
});

test(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/models/decode_options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void main() {
' charset: Instance of \'Latin1Codec\',\n'
' charsetSentinel: true,\n'
' comma: true,\n'
' decodeDotInKeys: true,\n'
' decodeDotInKeys: false,\n'
' delimiter: ,,\n'
' depth: 10,\n'
' duplicates: combine,\n'
Expand Down

0 comments on commit 8650854

Please sign in to comment.