Made the body serialization respect the request's content-type header.

Supported content-type headers:
 - application/json
 - application/x-www-form-urlencoded