From c73388256aad039239cf3977d7b079e3f9323258 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 31 Aug 2020 22:22:57 +0800 Subject: Now uesr avatar put api returns etag. --- Timeline/Controllers/UserAvatarController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Timeline/Controllers/UserAvatarController.cs') 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) -- cgit v1.2.3