Even though JSON already has been our default format when performing HTTP requests (see here), we were still obliged to translate the body option to json, before passed to LHC, when performing requests having an HTTP body.
This also led to inelegant implementations, assuming or hard-code checking for "application/json" or a json-like string in the body – e.g. when compiling the url (see here) – and even though we have the http message "format" abstracted in LHC (see here)
Now
Body translation is now also performed by LHC. So we can continue working with plain ruby objects, and leave the rest to the selected LHC format or json as default. Which allows to cleanup the internal code, and prevents us from using .to_json everytime we pass a body.
MAJOR (not backwards compatible)
Before
Even though JSON already has been our default format when performing HTTP requests (see here), we were still obliged to translate the body option to json, before passed to LHC, when performing requests having an HTTP body.
This also led to inelegant implementations, assuming or hard-code checking for "application/json" or a json-like string in the body – e.g. when compiling the url (see here) – and even though we have the http message "format" abstracted in LHC (see here)
Now
Body translation is now also performed by LHC. So we can continue working with plain ruby objects, and leave the rest to the selected LHC format or
json
as default. Which allows to cleanup the internal code, and prevents us from using.to_json
everytime we pass a body.How to migrate
Simply remove all
.to_json
when handing over ruby objects to LHC as a body.Change
to