summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-01-11 10:01:05 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-01-11 20:38:41 -0800
commit5875d13984a4deca8ef06d33294d6f2e16b3f589 (patch)
treefb5a393ca2b7a7d95a7e310fb02bf6882f40c49a /src
parentb7769f8b2b4e151106b1c615fd30fba3d54981f1 (diff)
downloadDotNetOpenAuth-5875d13984a4deca8ef06d33294d6f2e16b3f589.zip
DotNetOpenAuth-5875d13984a4deca8ef06d33294d6f2e16b3f589.tar.gz
DotNetOpenAuth-5875d13984a4deca8ef06d33294d6f2e16b3f589.tar.bz2
Fixed some contracts around multipart post.
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth/Messaging/MultipartPostPart.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
index 9f1170f..f9a5988 100644
--- a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
+++ b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs
@@ -116,6 +116,10 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="contentType">Type of the content in HTTP Content-Type format.</param>
/// <returns>The constructed part.</returns>
public static MultipartPostPart CreateFormFilePart(string name, string filePath, string contentType) {
+ Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name));
+ Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(filePath));
+ Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentType));
+
string fileName = Path.GetFileName(filePath);
return CreateFormFilePart(name, fileName, contentType, File.OpenRead(filePath));
}
@@ -130,8 +134,8 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>The constructed part.</returns>
public static MultipartPostPart CreateFormFilePart(string name, string fileName, string contentType, Stream content) {
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name));
- Contract.Requires<ArgumentException>(fileName != null);
- Contract.Requires<ArgumentException>(contentType != null);
+ Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(fileName));
+ Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentType));
Contract.Requires<ArgumentException>(content != null);
var part = new MultipartPostPart("file");