summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-01-11 06:22:33 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-01-11 20:38:40 -0800
commitb7769f8b2b4e151106b1c615fd30fba3d54981f1 (patch)
treebd728b83093aef53060c5a404717226c9b814a11
parentebb410df2ce3cb1884c0f264b0391dcbae290db1 (diff)
downloadDotNetOpenAuth-b7769f8b2b4e151106b1c615fd30fba3d54981f1.zip
DotNetOpenAuth-b7769f8b2b4e151106b1c615fd30fba3d54981f1.tar.gz
DotNetOpenAuth-b7769f8b2b4e151106b1c615fd30fba3d54981f1.tar.bz2
Fixed multipart POST method to indicate files are not form-data.
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs9
-rw-r--r--src/DotNetOpenAuth/Messaging/MultipartPostPart.cs2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
index f87ae59..57614ba 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
@@ -38,6 +38,15 @@ namespace DotNetOpenAuth.Test.Messaging {
}
/// <summary>
+ /// Verifies file multiparts identify themselves as files and not merely form-data.
+ /// </summary>
+ [TestMethod]
+ public void FilePartAsFile() {
+ var part = MultipartPostPart.CreateFormFilePart("somename", "somefile", "plain/text", new MemoryStream());
+ Assert.AreEqual("file", part.ContentDisposition);
+ }
+
+ /// <summary>
/// Verifies MultiPartPost sends the right number of bytes.
/// </summary>
[TestMethod]
diff --git a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
index 7ef89a4..9f1170f 100644
--- a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
+++ b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
@@ -134,7 +134,7 @@ namespace DotNetOpenAuth.Messaging {
Contract.Requires<ArgumentException>(contentType != null);
Contract.Requires<ArgumentException>(content != null);
- var part = new MultipartPostPart("form-data");
+ var part = new MultipartPostPart("file");
part.ContentAttributes["name"] = name;
part.ContentAttributes["filename"] = fileName;
part.PartHeaders[HttpRequestHeader.ContentType] = contentType;