std::string UrlQuery::ToString(bool encode) const {
  if (parameters_.empty()) {
    return "";
  }

  std::string str;

  for (std::size_t i = 0; i < parameters_.size(); ++i) {
    if (i != 0) {
      str += "&";
    }
    str += parameters_[i].first + "=" + parameters_[i].second;
  }

  if (encode) {
    return Url::EncodeQuery(str);
  } else {
    return str;
  }
}
std::string UrlQuery::ToString(bool encode) const {
  if (parameters_.empty()) {
    return "";
  }

  std::string str;

  for (std::size_t i = 0; i < parameters_.size(); ++i) {
    if (i != 0) {
      str += "&";
    }
    str += parameters_[i].first + "=" + parameters_[i].second;
  }

  if (encode) {
    return Url::EncodeQuery(str);
  } else {
    return str;
  }
}