Example #1
0
        public async Task CreateHttpRequestMessageAsync_NoGzip()
        {
            var request = new HttpRequest(Http.HttpMethod.Get)
            {
                RequestUri = new Uri("https://index.hu/api/test")
            };

            var factory = new HttpRequestFactory(false);

            var requestMessage = await factory
                                 .CreateHttpRequestMessageAsync(HttpContentSerializer, request);

            Assert.NotNull(requestMessage);
            Assert.Equal(request.Method, requestMessage.Method);
            Assert.Equal(new Uri("https://index.hu/api/test"), requestMessage.RequestUri);

            Assert.Single(requestMessage.Headers.Accept);
            Assert.Single(requestMessage.Headers.AcceptCharset);

            Assert.DoesNotContain("gzip", requestMessage.Headers.AcceptEncoding.Select(h => h.Value).ToList());
            Assert.DoesNotContain("deflate", requestMessage.Headers.AcceptEncoding.Select(h => h.Value).ToList());

            Assert.Null(requestMessage.Content);
        }