Added check if response is json or xml.