public CompositeBufferContent(CompositeContent content, CancellationToken cancellationToken)
        {
            this.content           = content;
            this.cancellationToken = cancellationToken;

            Headers.ContentLength = content.Length;
        }
Esempio n. 2
0
        public void WithContent_method_for_composite_buffer_should_return_a_request_with_provided_content()
        {
            var content = new CompositeContent(new Content[] {});

            var requestAfter = request.WithContent(content);

            requestAfter.Should().NotBeSameAs(request);
            requestAfter.CompositeContent.Should().BeSameAs(content);
        }
Esempio n. 3
0
        public void WithContent_method_for_composite_buffer_should_set_content_length_header()
        {
            var content = new CompositeContent(new Content[]
            {
                new Content(new byte[15]),
                new Content(new byte[16])
            });

            request.WithContent(content).Headers.ContentLength.Should().Be("31");
        }
Esempio n. 4
0
        public void WithContent_method_for_composite_buffer_should_set_content_length_header_even_if_original_request_had_no_headers()
        {
            request = new Request(request.Method, request.Url, request.Content);

            var content = new CompositeContent(new Content[]
            {
                new Content(new byte[15]),
                new Content(new byte[16])
            });

            request.WithContent(content).Headers.ContentLength.Should().Be("31");
        }