public async Task CreateFromRequest_RequestWithStreamBody()
        {
            var request = new HttpRequestMessage(HttpMethod.Get, new Uri("http://localhost:5000/api/users/1"))
            {
                Content = new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes("text")))
                {
                    Headers =
                    {
                        ContentType = new MediaTypeHeaderValue("text/plain")
                        {
                            CharSet = "utf-8"
                        }
                    }
                }
            };

            var record = await CassetteRecordRequest.CreateFromRequest(request, null);

            Assert.That(record.Method, Is.EqualTo(request.Method.Method));
            Assert.That(record.Uri, Is.EqualTo(request.RequestUri));
            Assert.That(record.Body, Is.EqualTo(new BytesCassetteBody(Encoding.UTF8.GetBytes("text"))));

            // Host header should be added always
            Assert.That(record.Headers, Has.Count.EqualTo(2));
            Assert.That(record.Headers["Host"], Is.EqualTo(request.RequestUri.IdnHost));
            Assert.That(record.Headers["Content-Type"], Contains.Substring("text/plain").And.Contains("utf-8"));
        }
        public async Task CreateFromRequest_RequestWithoutBody()
        {
            var request = new HttpRequestMessage(HttpMethod.Get, new Uri("http://localhost:5000/api/users/1"));

            var record = await CassetteRecordRequest.CreateFromRequest(request, null);

            Assert.That(record.Method, Is.EqualTo(request.Method.Method));
            Assert.That(record.Uri, Is.EqualTo(request.RequestUri));
            Assert.That(record.Body, Is.Null);

            // Host header should be added always
            Assert.That(record.Headers, Has.Count.EqualTo(1));
            Assert.That(record.Headers["Host"], Is.EqualTo(request.RequestUri.IdnHost));
        }