From 87513987a23ecd75cd21015ed215bae3b279d8c5 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 19 Aug 2019 22:52:01 +0800 Subject: Add check for content in avatar put. --- Timeline/Models/Http/Common.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Timeline/Models') 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. /// 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() { -- cgit v1.2.3