aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/Http
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-19 22:55:59 +0800
committerGitHub <noreply@github.com>2019-08-19 22:55:59 +0800
commit4af6c82f34dd79d7a1ca348f167e01570951e3ad (patch)
tree5725e61da570be86173472d68bd6df521e593b65 /Timeline/Models/Http
parent134173eda92de04961dc69757b257c1c547d88a4 (diff)
parent577d282f8e8f44f1a48b9dbf7dd90e8ef50c7a53 (diff)
downloadtimeline-4af6c82f34dd79d7a1ca348f167e01570951e3ad.tar.gz
timeline-4af6c82f34dd79d7a1ca348f167e01570951e3ad.tar.bz2
timeline-4af6c82f34dd79d7a1ca348f167e01570951e3ad.zip
Merge pull request #46 from crupest/avatar-put-content-legnth
Add check for content in avatar put.
Diffstat (limited to 'Timeline/Models/Http')
-rw-r--r--Timeline/Models/Http/Common.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/Timeline/Models/Http/Common.cs b/Timeline/Models/Http/Common.cs
index b4932754..50f6836e 100644
--- a/Timeline/Models/Http/Common.cs
+++ b/Timeline/Models/Http/Common.cs
@@ -9,6 +9,10 @@ namespace Timeline.Models.Http
/// For example a required field is null.
/// </summary>
public const int InvalidModel = -100;
+
+ public const int Header_Missing_ContentType = -111;
+ public const int Header_Missing_ContentLength = -112;
+ public const int Header_Zero_ContentLength = -113;
}
public static CommonResponse InvalidModel(string message)
@@ -16,6 +20,21 @@ namespace Timeline.Models.Http
return new CommonResponse(ErrorCodes.InvalidModel, message);
}
+ public static CommonResponse MissingContentType()
+ {
+ return new CommonResponse(ErrorCodes.Header_Missing_ContentType, "Header Content-Type is required.");
+ }
+
+ public static CommonResponse MissingContentLength()
+ {
+ return new CommonResponse(ErrorCodes.Header_Missing_ContentLength, "Header Content-Length is missing or of bad format.");
+ }
+
+ public static CommonResponse ZeroContentLength()
+ {
+ return new CommonResponse(ErrorCodes.Header_Zero_ContentLength, "Header Content-Length must not be 0.");
+ }
+
public CommonResponse()
{