code: public static Headers varyHeaders(Headers requestHeaders, Headers responseHeaders) {
      Set<String> varyFields = varyFields(responseHeaders);
      if (varyFields.isEmpty()) return EMPTY_HEADERS;
  
      Headers.Builder result = new Headers.Builder();
      for (int i = 0, size = requestHeaders.size(); i < size; i++) {
        String fieldName = requestHeaders.name(i);
        if (varyFields.contains(fieldName)) {
          result.add(fieldName, requestHeaders.value(i));
        }
      }
      return result.build();
    }
docs: Returns the subset of the headers in {@code requestHeaders} that impact the content of
  response's body.