public static IHttpClientBuilder WithHeader(this IHttpClientBuilder builder, string name, string value) { return(builder.WithHeadersConfiguration(h => { if (h.Contains(name)) { h.Remove(name); } h.Add(name, value); })); }
public static IHttpClientBuilder WithNoCache(this IHttpClientBuilder builder, bool nocache = true) { return(builder.WithHeadersConfiguration( h => { if (h.CacheControl == null) { h.CacheControl = new CacheControlHeaderValue(); } h.CacheControl.NoCache = nocache; h.CacheControl.NoStore = nocache; })); }
public static IHttpClientBuilder WithAppendHeader(this IHttpClientBuilder builder, string name, IEnumerable <string> values) { return(builder.WithHeadersConfiguration(h => h.Add(name, values))); }