public static IAdvancedHttpBuilder WithOptionalHandlerConfiguration <THandler>(this IAdvancedHttpBuilder builder, Action <THandler> configure) where THandler : class, IHttpHandler { builder.WithConfiguration(s => s.HandlerRegister.WithConfiguration(configure, false)); return(builder); }
public static IAdvancedHttpBuilder OnSending(this IAdvancedHttpBuilder builder, Action <HttpSendingContext> handler) { builder.WithConfiguration(s => s.HandlerRegister.WithSendingHandler(handler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheExpired(this IAdvancedHttpBuilder builder, HandlerPriority priority, Action <CacheExpiredContext> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithExpiredHandler(priority, cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder WithSuppressCancellationExceptions(this IAdvancedHttpBuilder builder, bool suppress = true) { builder.WithConfiguration(s => s.SuppressCancellationErrors = suppress); return(builder); }
public static IAdvancedHttpBuilder WithAutoDecompression(this IAdvancedHttpBuilder builder, bool enabled = true) { builder.WithConfiguration(s => s.AutoDecompression = true); return(builder.WithClientConfiguration(c => c.WithDecompressionMethods(enabled ? DecompressionMethods.GZip | DecompressionMethods.Deflate : DecompressionMethods.None))); }
public static IAdvancedHttpBuilder WithSuccessfulResponseValidator(this IAdvancedHttpBuilder builder, Func <HttpResponseMessage, bool> validator) { if (validator == null) { throw new ArgumentNullException(nameof(validator)); } builder.WithConfiguration(s => s.ResponseValidator.Add(new ResponseValidatorFunc(validator))); return(builder); }
public static IAdvancedHttpBuilder WithMediaType(this IAdvancedHttpBuilder builder, string mediaType) { if (mediaType == null) { return(builder); } builder.WithConfiguration(s => s.MediaType = mediaType); builder.WithAcceptHeaderValue(mediaType); return(builder); }
public static IAdvancedHttpBuilder WithContentEncoding(this IAdvancedHttpBuilder builder, Encoding encoding) { if (encoding == null) { return(builder); } builder.WithConfiguration(s => s.ContentEncoding = encoding); builder.WithAcceptCharSet(encoding); return(builder); }
public static IAdvancedHttpBuilder OnExceptionAsync(this IAdvancedHttpBuilder builder, HandlerPriority priority, Func <HttpExceptionContext, Task> handler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncExceptionHandler(priority, handler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheExpiredAsync(this IAdvancedHttpBuilder builder, HandlerPriority priority, Func <CacheExpiredContext, Task> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncExpiredHandler(priority, cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder WithHandler(this IAdvancedHttpBuilder builder, IHttpHandler httpHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithHandler(httpHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheExpiringAsync(this IAdvancedHttpBuilder builder, Func <CacheExpiringContext, Task> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncExpiringHandler(cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheExpiring(this IAdvancedHttpBuilder builder, Action <CacheExpiringContext> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithExpiringHandler(cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheStoreAsync(this IAdvancedHttpBuilder builder, HandlerPriority priority, Func <CacheStoreContext <HttpResponseMessage>, Task> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncStoreHandler(priority, cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheStore(this IAdvancedHttpBuilder builder, Action <CacheStoreContext <HttpResponseMessage> > cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithStoreHandler(cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheMissAsync(this IAdvancedHttpBuilder builder, Func <CacheMissContext <HttpResponseMessage>, Task> cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncMissHandler(cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnCacheMiss(this IAdvancedHttpBuilder builder, HandlerPriority priority, Action <CacheMissContext <HttpResponseMessage> > cacheHandler) { builder.WithConfiguration(s => s.HandlerRegister.WithMissHandler(priority, cacheHandler)); return(builder); }
public static IAdvancedHttpBuilder OnException(this IAdvancedHttpBuilder builder, HandlerPriority priority, Action <HttpExceptionContext> handler) { builder.WithConfiguration(s => s.HandlerRegister.WithExceptionHandler(priority, handler)); return(builder); }
public static IAdvancedHttpBuilder OnSentAsync(this IAdvancedHttpBuilder builder, Func <HttpSentContext, Task> handler) { builder.WithConfiguration(s => s.HandlerRegister.WithAsyncSentHandler(handler)); return(builder); }
public static IAdvancedHttpBuilder WithContextItem(this IAdvancedHttpBuilder builder, string key, object value) { builder.WithConfiguration(s => s.Items[key] = value); return(builder); }
public static IAdvancedHttpBuilder WithExceptionFactory(this IAdvancedHttpBuilder builder, Func <HttpResponseMessage, HttpRequestMessage, Exception> factory) { builder.WithConfiguration(s => s.ExceptionFactory = factory); return(builder); }