code: public static void restrictHeaders(HttpRequestMessage request, String[] restrictions) {
          if (request == null) {
              throw new IllegalArgumentException("Request is null.");
          }
  
          if (restrictions == null || restrictions.length == 0) {
              request.setHeaders(EMPTY_HEADERS);
              return;
          }
  
          Map<String, List<String>> headers = request.getHeaders();
          if (headers == null || headers.size() == 0) {
              return;
          }
  
          // Get a mutable map
          headers = new HashMap<>(headers);
  
          final Set<String> headerNames = new HashSet<>(headers.keySet());
  
          for (String header : headerNames) {
  
              if (header == null || (header.length() == 0)) {
                  throw new IllegalArgumentException("Invalid header in the HTTP request");
              }
  
              boolean ok = false;
              for (String restrictedHeaderName : restrictions) {
                  if (header.equalsIgnoreCase(restrictedHeaderName)) {
                      ok = true;
                      break;
                  }
              }
  
              if (!ok) {
                  headers.remove(header);
              }
          }
  
          // Set the (possibly mutated) map
          request.setHeaders(headers);
      }
docs: includesHeaders