public static RequestBuilder WithAuthentication(this RequestBuilder requestBuilder, string scheme, string parameter)
        {
            requestBuilder.OnRequest(r => r.Headers.Authorization = new AuthenticationHeaderValue(scheme, parameter));

            return(requestBuilder);
        }
示例#2
0
        public static RequestBuilder WithJsonSerializer(this RequestBuilder requestBuilder)
        {
            requestBuilder.Configure(c => c.Serialization = new JsonSerialization());

            return(requestBuilder);
        }
        public static RequestBuilder WithSerializer(this RequestBuilder requestBuilder, ISerialization serialization)
        {
            requestBuilder.Configure(c => c.Serialization = serialization);

            return(requestBuilder);
        }
        public static RequestBuilder WithHeader(this RequestBuilder requestBuilder, string name, params string[] values)
        {
            requestBuilder.OnRequest(r => r.Headers.Add(name, values));

            return(requestBuilder);
        }
        public static RequestBuilder OnResponse(this RequestBuilder requestBuilder, Func <HttpResponseMessage, Task> onResponseMessage)
        {
            requestBuilder.AddMessageListener(new SimpleMessageListener(null, onResponseMessage));

            return(requestBuilder);
        }
        public static RequestBuilder OnRequest(this RequestBuilder requestBuilder, Action <HttpRequestMessage> onRequestMessage)
        {
            requestBuilder.AddMessageListener(new SimpleMessageListener(onRequestMessage, null));

            return(requestBuilder);
        }
        public static RequestBuilder WithListener(this RequestBuilder requestBuilder, IMessageListener messageListener)
        {
            requestBuilder.AddMessageListener(messageListener);

            return(requestBuilder);
        }