Right now I think we get an error if the user tries to send a empty POST request with the content type set to json. While the correct thing might still be not to set content type to json for a request without any body, it still can create hard to figure out bugs when you API changes and you acccidentlity leave the json header but remove the body.
Example:
var response = await _client.post('$_backend/orgs/$org_id/pools/$pool_id/services/mongodbs/$service_id/databases/$database_name',
headers: {"Content-type": "application/json"});
Solution:
In the parsing of the json variable we could check for an empty body and if so don't try to parse the empty body as json.
Right now I think we get an error if the user tries to send a empty POST request with the content type set to json. While the correct thing might still be not to set content type to json for a request without any body, it still can create hard to figure out bugs when you API changes and you acccidentlity leave the json header but remove the body.
Example:
Solution: In the parsing of the
json
variable we could check for an empty body and if so don't try to parse the empty body as json.