Modifies the output of POST canonicalization query strings in pywb to use native JSON values for booleans, numbers, and null, rather than a string representation of their Python values.
This commit also adds a more complicated JSON test case that is also in warcio.js to ensure parity.
We now handle numbers like JavaScript's Number.prototype.toString() by dropping decimal from floats if they represent whole number, to ensure consistency between pywb and warcio.js.
Motivation and context
This is part of a cross-repo effort to standardize how POST canonicalization works in Webrecorder tools, and document this in a Webrecorder specfiication.
Testing notes
Seems to be working well with fuzzy matching on replay, but could use some additional testing.
Types of changes
[ ] Replay fix (fixes a replay specific issue)
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[] My change requires a change to the documentation
[ ] I have updated the documentation accordingly.
[x] I have added or updated tests to cover my changes.
Fixes #859
Description
Modifies the output of POST canonicalization query strings in pywb to use native JSON values for booleans, numbers, and null, rather than a string representation of their Python values.
This commit also adds a more complicated JSON test case that is also in warcio.js to ensure parity.
We now handle numbers like JavaScript's Number.prototype.toString() by dropping decimal from floats if they represent whole number, to ensure consistency between pywb and warcio.js.
Motivation and context
This is part of a cross-repo effort to standardize how POST canonicalization works in Webrecorder tools, and document this in a Webrecorder specfiication.
Testing notes
Seems to be working well with fuzzy matching on replay, but could use some additional testing.
Types of changes
Checklist: