properly check for HTTP body before doing anything with it
handle gzip encoding of HTTP body