private ISender BuildSender()
        {
            if (this.httpSender != null)
            {
                return(this.httpSender);
            }

            ISender sender = new NativeSender(this.maxTimeout, this.proxy);

            sender = new StatusCodeSender(sender);

            if (this.customHeaders != null)
            {
                sender = new CustomHeaderSender(this.customHeaders, sender);
            }

            if (this.signer != null)
            {
                sender = new SigningSender(this.signer, sender);
            }

            sender = new URLPrefixSender(this.urlPrefix, sender);

            if (this.maxRetries > 0)
            {
                sender = new RetrySender(this.maxRetries, sender);
            }

            sender = new LicenseSender(this.licenses, sender);

            return(sender);
        }
Beispiel #2
0
        public void TestAddingHeaders()
        {
            var headers = new Dictionary <string, string>
            {
                ["Test1"] = "value1",
                ["Test2"] = "value2"
            };

            var mockSender      = new MockSender(null);
            var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender);
            var sender          = new CustomHeaderSender(headers, urlPrefixSender);

            sender.Send(new Request());

            Assert.AreEqual("value1", mockSender.Request.Headers["Test1"]);
            Assert.AreEqual("value2", mockSender.Request.Headers["Test2"]);
        }