public static String queryParamString(final Collection<Map.Entry<String, String>> params) {
    final StringBuilder sb = new StringBuilder();
    if (params.isEmpty()) {
      return sb.toString();
    }
    sb.append("?");
    sb.append(params.stream()
        .map(e -> "%s=%s".formatted(
            URLEncoder.encode(e.getKey(), StandardCharsets.UTF_8),
            URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8)))
        .collect(Collectors.joining("&")));
    return sb.toString();
  }
@Test
  public void queryParameterStringEncodesUnsafeChars() {
    final String result = HttpUtils.queryParamString(List.of(Map.entry("&k?e=y/!", "=v/a?l&u;e")));
    assertThat(result).isEqualTo("?%26k%3Fe%3Dy%2F%21=%3Dv%2Fa%3Fl%26u%3Be");
  }