public void OuterHandlerAndResultAreSameInstance() { var innerHandler = new HttpClientHandler(); var outerHandler = new TestDelegatingHandler(); var result = innerHandler.DecorateWith(outerHandler); Assert.Same(outerHandler, result); }
public void InnerHandlerAreSameInstance() { var innerHandler = new HttpClientHandler(); var outerHandler = new TestDelegatingHandler(); innerHandler.DecorateWith(outerHandler); Assert.Same(innerHandler, outerHandler.InnerHandler); }
private MidaxoHttpClient CreateHttpClient(string baseUrl) { CookieContainer cookies_ = new CookieContainer(); HttpClientHandler handler = new HttpClientHandler() { CookieContainer = cookies_, Proxy = new WebProxy(@"http://localhost:8888", false), AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; //var handlersPipeline = new XSRFAuthMessageHandler(cookies_) //{ InnerHandler = handler }; var handlersPipeline = handler .DecorateWith(new XSRFAuthMessageHandler(cookies_)); return(new MidaxoHttpClient(handlersPipeline) { BaseAddress = new Uri(baseUrl) }); }