Empty body in answers causes appium to crash

Sometimes responses do not have a body. For example, a response with 500 status code will not have a body.
Check if body is set and then work with it.