diff options
| author | crupest <crupest@outlook.com> | 2020-08-28 00:01:04 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2020-08-28 00:01:04 +0800 |
| commit | 315a5fa6eea7511618266877fca6aa1275caed1c (patch) | |
| tree | 8452312130c4f763c1c30a525f0e1b1fa0e8af94 /Timeline/Filters | |
| parent | bdff6f0ad414f1ec1352d1d4e36c78e06e02ab80 (diff) | |
| download | timeline-315a5fa6eea7511618266877fca6aa1275caed1c.tar.gz timeline-315a5fa6eea7511618266877fca6aa1275caed1c.tar.bz2 timeline-315a5fa6eea7511618266877fca6aa1275caed1c.zip | |
Add change timeline name api to timeline controller.
Diffstat (limited to 'Timeline/Filters')
| -rw-r--r-- | Timeline/Filters/Timeline.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Timeline/Filters/Timeline.cs b/Timeline/Filters/Timeline.cs index 90b87223..6a730ee7 100644 --- a/Timeline/Filters/Timeline.cs +++ b/Timeline/Filters/Timeline.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Timeline.Models.Http;
using Timeline.Services.Exceptions;
@@ -13,11 +14,17 @@ namespace Timeline.Filters {
if (e.InnerException is UserNotExistException)
{
- context.Result = new NotFoundObjectResult(ErrorResponse.UserCommon.NotExist());
+ if (HttpMethods.IsGet(context.HttpContext.Request.Method))
+ context.Result = new NotFoundObjectResult(ErrorResponse.UserCommon.NotExist());
+ else
+ context.Result = new BadRequestObjectResult(ErrorResponse.UserCommon.NotExist());
}
else
{
- context.Result = new NotFoundObjectResult(ErrorResponse.TimelineController.NotExist());
+ if (HttpMethods.IsGet(context.HttpContext.Request.Method))
+ context.Result = new NotFoundObjectResult(ErrorResponse.TimelineController.NotExist());
+ else
+ context.Result = new BadRequestObjectResult(ErrorResponse.TimelineController.NotExist());
}
}
}
|
