@Nullable
    static <T> T mapCurrent(
            Function<? super ClientRequestContext, T> mapper, @Nullable Supplier<T> defaultValueSupplier) {

        final ClientRequestContext ctx = currentOrNull();
        if (ctx != null) {
            return mapper.apply(ctx);
        }

        final ServiceRequestContext serviceRequestContext = ServiceRequestContext.currentOrNull();
        if (serviceRequestContext != null) {
            throw new IllegalStateException("The current context is not a client-side context: " +
                                            serviceRequestContext);
        }

        if (defaultValueSupplier != null) {
            return defaultValueSupplier.get();
        }

        return null;
    }
Maps the client-side context of the {@link Request} that is being handled in the current thread.

@param mapper the {@link Function} that maps the {@link ClientRequestContext}
@param defaultValueSupplier the {@link Supplier} that provides the value when the context is unavailable
                            in the current thread. If {@code null}, the {@code null} will be returned
                            when the context is unavailable in the current thread.
@throws IllegalStateException if the current context is not a {@link ClientRequestContext}.
core/src/main/java/com/linecorp/armeria/client/ClientRequestContext.java