filipeavsilva / http-multipart-parser

A simple HTTP multipart parser for .NET (3.5)
MIT License
7 stars 4 forks source link

Content-Transfer-Encoding supports. Only base64 is supported for now #7

Closed bingzer closed 10 years ago

bingzer commented 10 years ago

Base64 supports in Content-Transfer-Encoding. No difference in API.

--7a1d30f95d847a130f0e77ca
Content-Disposition: form-data; name="this_is_name"; filename="this_is_filename"
Content-Transfer-Encoding: Base64
Content-Type: application/octet-stream

SGVsbG8gVGhpcyBpcyBhIGNvbnRlbnQ=
--7a1d30f95d847a130f0e77ca
Assert.AreEqual("this_is_filename", part.FileName);
Assert.AreEqual("this_is_name", part.Name);
Assert.IsTrue(part.IsBinary);
Assert.AreEqual("Base64", part.ContentTransferEncoding);
Assert.AreEqual("application/octet-stream", part.ContentType);

var bytes = (byte[])part.GetData();
var stringContent = Encoding.UTF8.GetString(bytes);
Assert.AreEqual("Hello This is a content", stringContent);