diff --git a/test/Microsoft.AspNet.Http.Core.Tests/FormFeatureTests.cs b/test/Microsoft.AspNet.Http.Core.Tests/FormFeatureTests.cs index 7f1224c1b7..254a6800ea 100644 --- a/test/Microsoft.AspNet.Http.Core.Tests/FormFeatureTests.cs +++ b/test/Microsoft.AspNet.Http.Core.Tests/FormFeatureTests.cs @@ -96,31 +96,32 @@ namespace Microsoft.AspNet.Http.Core private const string MultipartContentType = "multipart/form-data; boundary=WebKitFormBoundary5pDRpGheQXaM8k3T"; private const string EmptyMultipartForm = -@"--WebKitFormBoundary5pDRpGheQXaM8k3T--"; +"--WebKitFormBoundary5pDRpGheQXaM8k3T--"; + // Note that CRLF (\r\n) is required. You can't use multi-line C# strings here because the line breaks on Linux are just LF. private const string MultipartFormWithField = -@"--WebKitFormBoundary5pDRpGheQXaM8k3T -Content-Disposition: form-data; name=""description"" - -Foo ---WebKitFormBoundary5pDRpGheQXaM8k3T--"; +"--WebKitFormBoundary5pDRpGheQXaM8k3T\r\n" + +"Content-Disposition: form-data; name=\"description\"\r\n" + +"\r\n" + +"Foo\r\n" + +"--WebKitFormBoundary5pDRpGheQXaM8k3T--"; private const string MultipartFormWithFile = -@"--WebKitFormBoundary5pDRpGheQXaM8k3T -Content-Disposition: form-data; name=""myfile1""; filename=""temp.html"" -Content-Type: text/html - -
Hello World ---WebKitFormBoundary5pDRpGheQXaM8k3T--"; +"--WebKitFormBoundary5pDRpGheQXaM8k3T\r\n" + +"Content-Disposition: form-data; name=\"myfile1\"; filename=\"temp.html\"\r\n" + +"Content-Type: text/html\r\n" + +"\r\n" + +"Hello World\r\n" + +"--WebKitFormBoundary5pDRpGheQXaM8k3T--"; private const string MultipartFormWithFieldAndFile = -@"--WebKitFormBoundary5pDRpGheQXaM8k3T -Content-Disposition: form-data; name=""description"" - -Foo ---WebKitFormBoundary5pDRpGheQXaM8k3T -Content-Disposition: form-data; name=""myfile1""; filename=""temp.html"" -Content-Type: text/html - -Hello World ---WebKitFormBoundary5pDRpGheQXaM8k3T--"; +"--WebKitFormBoundary5pDRpGheQXaM8k3T\r\n" + +"Content-Disposition: form-data; name=\"description\"\r\n" + +"\r\n" + +"Foo\r\n" + +"--WebKitFormBoundary5pDRpGheQXaM8k3T\r\n" + +"Content-Disposition: form-data; name=\"myfile1\"; filename=\"temp.html\"\r\n" + +"Content-Type: text/html\r\n" + +"\r\n" + +"Hello World\r\n" + +"--WebKitFormBoundary5pDRpGheQXaM8k3T--"; [Fact] public async Task ReadForm_EmptyMultipart_ReturnsParsedFormCollection() diff --git a/test/Microsoft.AspNet.WebUtilities.Tests/MultipartReaderTests.cs b/test/Microsoft.AspNet.WebUtilities.Tests/MultipartReaderTests.cs index 49a5abedd0..2dd618cdf1 100644 --- a/test/Microsoft.AspNet.WebUtilities.Tests/MultipartReaderTests.cs +++ b/test/Microsoft.AspNet.WebUtilities.Tests/MultipartReaderTests.cs @@ -11,72 +11,68 @@ namespace Microsoft.AspNet.WebUtilities public class MultipartReaderTests { private const string Boundary = "9051914041544843365972754266"; + // Note that CRLF (\r\n) is required. You can't use multi-line C# strings here because the line breaks on Linux are just LF. private const string OnePartBody = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266-- -"; +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"text\"\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266--\r\n"; private const string OnePartBodyWithTrailingWhitespace = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266-- -"; +"--9051914041544843365972754266 \r\n" + +"Content-Disposition: form-data; name=\"text\"\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266--\r\n"; // It's non-compliant but common to leave off the last CRLF. private const string OnePartBodyWithoutFinalCRLF = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266--"; +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"text\"\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266--"; private const string TwoPartBody = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266 -Content-Disposition: form-data; name=""file1""; filename=""a.txt"" -Content-Type: text/plain - -Content of a.txt. - ---9051914041544843365972754266-- -"; +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"text\"\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"\r\n" + +"Content-Type: text/plain\r\n" + +"\r\n" + +"Content of a.txt.\r\n" + +"\r\n" + +"--9051914041544843365972754266--\r\n"; private const string TwoPartBodyWithUnicodeFileName = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266 -Content-Disposition: form-data; name=""file1""; filename=""a色.txt"" -Content-Type: text/plain - -Content of a.txt. - ---9051914041544843365972754266-- -"; +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"text\"\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266\r\n" + +"Content-Disposition: form-data; name=\"file1\"; filename=\"a色.txt\"\r\n" + +"Content-Type: text/plain\r\n" + +"\r\n" + +"Content of a.txt.\r\n" + +"\r\n" + +"--9051914041544843365972754266--\r\n"; private const string ThreePartBody = -@"--9051914041544843365972754266 -Content-Disposition: form-data; name=""text"" - -text default ---9051914041544843365972754266 -Content-Disposition: form-data; name=""file1""; filename=""a.txt"" -Content-Type: text/plain - -Content of a.txt. - ---9051914041544843365972754266 -Content-Disposition: form-data; name=""file2""; filename=""a.html"" -Content-Type: text/html - -