java okhttp 添加 headers 使用 for 循环动态

java okhttp adding headers using for loop dynamically

许多示例显示添加 header 应该:

Request request = new Request.Builder()
    .url("https://api.github.com/repos/square/okhttp/issues")
    .header("User-Agent", "OkHttp Headers.java")
    .addHeader("Accept", "application/json; q=0.5")
    .addHeader("Accept", "application/vnd.github.v3+json")
    .build();

但是我想动态添加header作为用户的header要求,我该如何实现呢?

Headers h = new Headers.Builder().build();
for (HttpHeader hh : ht.HttpRequestHeader) {
    h.newBuilder().add(hh.Name, hh.Value);
}  //<<---Nothing changed!!!!!
Headers.Builder builder = new Headers.Builder();
for (HttpHeader hh : ht.HttpRequestHeader) {
  builder.add(hh.Name, hh.Value);
}
Headers h = builder.build();