示例#1
0
        public static FluentHttpClientBuilder AddMessageListener <T>(this FluentHttpClientBuilder builder) where T : IMessageListener, new()
        {
            var listener = new T();

            builder.AddMessageListener(listener);

            return(builder);
        }
示例#2
0
        public static FluentHttpClientBuilder AddMessageListener(this FluentHttpClientBuilder builder, IEnumerable <IMessageListener> listeners)
        {
            foreach (var listener in listeners)
            {
                builder.AddMessageListener(listener);
            }

            return(builder);
        }
示例#3
0
        public static FluentHttpClientBuilder OnResponse(this FluentHttpClientBuilder builder, Action <HttpResponseMessage> onResponseMessage)
        {
            builder.AddMessageListener(new SimpleMessageListener(null, onResponseMessage));

            return(builder);
        }
示例#4
0
        public static FluentHttpClientBuilder OnRequest(this FluentHttpClientBuilder builder, Action <HttpRequestMessage> onRequestMessage)
        {
            builder.AddMessageListener(new SimpleMessageListener(onRequestMessage, null));

            return(builder);
        }