✍️ Description of changes:
Ergonomic improvements to HTTP payload deserialization with intent-driven helper methods (json and form_url_encoded are the initial implementations). Details in RFC (#917).
Note: there was a bug in RequestPayloadExt::payload where if the content-type header was present but the body was empty, it would try to parse it anyways, resulting in a PayloadError. The bug was fixed when I updated the function to delegate to json and form_urlencoded. I added a couple unit tests in this PR for that scenario to ensure the behavior doesn't regress if its implementation drifts from the new functions in the future.
🔏 By submitting this pull request
[X] I confirm that I've ran cargo +nightly fmt.
[X] I confirm that I've ran cargo clippy --fix.
[X] I confirm that I've made a best effort attempt to update all relevant documentation.
[X] I confirm that my contribution is made under the terms of the Apache 2.0 license.
📬 Issue #, if available:
917
✍️ Description of changes: Ergonomic improvements to HTTP payload deserialization with intent-driven helper methods (
json
andform_url_encoded
are the initial implementations). Details in RFC (#917).Note: there was a bug in
RequestPayloadExt::payload
where if the content-type header was present but the body was empty, it would try to parse it anyways, resulting in a PayloadError. The bug was fixed when I updated the function to delegate tojson
andform_urlencoded
. I added a couple unit tests in this PR for that scenario to ensure the behavior doesn't regress if its implementation drifts from the new functions in the future.🔏 By submitting this pull request
cargo +nightly fmt
.cargo clippy --fix
.