Merge pull request #2020 from tomjepp/master
[mono.git] / mcs / class / System.Net.Http / Test / System.Net.Http / StreamContentTest.cs
index 5d7cd12490ccadcbda86267f2a3983c9444dff8b..e56094741263210f94b21d56a8bb6093ffb410ff 100644 (file)
@@ -36,6 +36,7 @@ using System.IO;
 using System.Threading.Tasks;
 using System.Net;
 using System.Linq;
+using System.Text;
 
 namespace MonoTests.System.Net.Http
 {
@@ -327,6 +328,15 @@ namespace MonoTests.System.Net.Http
                        Assert.AreEqual ("Content-MD5: AwU=\r\n", headers.ToString (), "#1");
                }
 
+               [Test]
+               public void Headers_ContentLength ()
+               {
+                       var content = new StreamContent (new MemoryStream (Encoding.UTF8.GetBytes ("test")));
+                       Assert.AreEqual ("", content.Headers.ToString ());
+                       var length = content.Headers.ContentLength;
+                       Assert.AreEqual ("Content-Length: 4\r\n", content.Headers.ToString ());
+               }
+
                [Test]
                public void Headers_Invalid ()
                {