Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
seionmoya committed Nov 15, 2024
1 parent 6507df6 commit 59d549a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Fuyu.Backend.BSG/Services/EtagService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ namespace Fuyu.Backend.BSG.Services
{
public class ETagService
{
// NOTE: why BSG decided to put the crc is quotes is beyond me
// -- seionmoya, 2024-11-14
public static uint GetUIntETag(HttpContext context)
{
var value = context.GetETag()
.Replace("\"", string.Empty);
var value = context.GetETag();

if (string.IsNullOrWhiteSpace(value))
{
return 0u;
}

// NOTE: why BSG decided to put the crc is quotes is beyond me
// -- seionmoya, 2024-11-14
value = value.Replace("\"", string.Empty);

return Convert.ToUInt32(value);
}

Expand All @@ -43,9 +44,6 @@ public static Task SendCachedAsync<TResponse>(HttpContext context, ResponseBody<
var cached = GetUIntETag(context);
var crc = GetCrc(response.data);

Fuyu.Common.IO.Terminal.WriteLine(cached);
Fuyu.Common.IO.Terminal.WriteLine(crc);

if (IsCacheInvalid(cached, crc))
{
// outdated client cache
Expand All @@ -55,7 +53,7 @@ public static Task SendCachedAsync<TResponse>(HttpContext context, ResponseBody<
else
{
// up-to-date client cache
return context.SendStatus(HttpStatusCode.NoContent);
return context.SendStatus(HttpStatusCode.NotModified);
}
}
}
Expand Down

0 comments on commit 59d549a

Please sign in to comment.