handleResponse(response, type) {
    var r;

    if (type == "json") {
      r = JSON.parse(response);
    } else if (Object(core["isXml"])(type)) {
      r = Object(core["parse"])(response, "text/xml");
    } else if (type == "xhtml") {
      r = Object(core["parse"])(response, "application/xhtml+xml");
    } else if (type == "html" || type == "htm") {
      r = Object(core["parse"])(response, "text/html");
    } else {
      r = response;
    }

    return r;
  }
Handle the response from request
@private
@param  {any} response
@param  {string} [type]
@return {any} the parsed result