[swift6] Encode request bodies as compact JSON
Merged
SP
4d ago+0+0+0123456789-14-14-01234567890123456789
Fixes #25186.
Drop .prettyPrinted from CodableHelper's default JSONEncoder, so request bodies are compact JSON. The JSON content is identical, only the whitespace goes. A jsonEncoder set by the user is unaffected, and so is anyone who sets outputFormatting themselves.
DateFormatTests.testCodableAlwaysResultsInUTCEncodedDate already removes .prettyPrinted, so that line becomes a no-op and the tests are unaffected.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
Commit all changed files../mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/swift6*.yaml || exit - @mention the technical committee: @jgavris @ehyche @Edubits @jaz-ah @4brunu @dydus0x14
Summary by cubic
Makes Swift 6 request bodies compact JSON by removing .prettyPrinted from CodableHelper's default JSONEncoder, so outgoing bodies no longer carry unnecessary whitespace.
- Request bodies are now smaller on the wire; the JSON content is unchanged.
- A user-supplied
jsonEncoderis unaffected, and anyone settingoutputFormattingthemselves keeps full control. - Regenerates all swift6 samples to match the new default.