default HttpRequest mapHeaders(Function<? super RequestHeaders, ? extends RequestHeaders> function) {
        requireNonNull(function, "function");
        final RequestHeaders transformed = function.apply(headers());
        requireNonNull(transformed, "function.apply() returned null");
        return withHeaders(transformed);
    }
Transforms the {@link RequestHeaders} of this {@link HttpRequest} by applying the specified
{@link Function}.

<p>For example:<pre>{@code
HttpRequest request = HttpRequest.of(HttpMethod.GET, "/items");
HttpRequest transformed =
    request.mapHeaders(headers -> headers.toBuilder()
                                         .add("TraceId", "1")
                                         .build());
assert transformed.aggregate().join().headers().get("TraceId").equals("1");
}</pre>
core/src/main/java/com/linecorp/armeria/common/HttpRequest.java