aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserAvatarController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-31 22:22:57 +0800
committercrupest <crupest@outlook.com>2020-08-31 22:22:57 +0800
commit4dda5d088330e76844010a4f89049ea207652318 (patch)
tree2734232fc25cce0cedc05570482015c8f6f01199 /Timeline/Controllers/UserAvatarController.cs
parent315a5fa6eea7511618266877fca6aa1275caed1c (diff)
downloadtimeline-4dda5d088330e76844010a4f89049ea207652318.tar.gz
timeline-4dda5d088330e76844010a4f89049ea207652318.tar.bz2
timeline-4dda5d088330e76844010a4f89049ea207652318.zip
Now uesr avatar put api returns etag.
Diffstat (limited to 'Timeline/Controllers/UserAvatarController.cs')
-rw-r--r--Timeline/Controllers/UserAvatarController.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Timeline/Controllers/UserAvatarController.cs b/Timeline/Controllers/UserAvatarController.cs
index 97c4bdb8..bc4afa30 100644
--- a/Timeline/Controllers/UserAvatarController.cs
+++ b/Timeline/Controllers/UserAvatarController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Microsoft.Net.Http.Headers;
using System;
using System.Threading.Tasks;
using Timeline.Auth;
@@ -105,7 +106,7 @@ namespace Timeline.Controllers
try
{
- await _service.SetAvatar(id, new Avatar
+ var etag = await _service.SetAvatar(id, new Avatar
{
Data = body.Data,
Type = body.ContentType
@@ -113,6 +114,9 @@ namespace Timeline.Controllers
_logger.LogInformation(Log.Format(LogPutSuccess,
("Username", username), ("Mime Type", Request.ContentType)));
+
+ Response.Headers.Append("ETag", new EntityTagHeaderValue($"\"{etag}\"").ToString());
+
return Ok();
}
catch (ImageException e)