Properly dispose of StreamReaders

This commit is contained in:
Slendy 2023-02-11 19:08:44 -06:00
parent 75a5e70635
commit 14fa5e9328
No known key found for this signature in database
GPG key ID: 7288D68361B91428
5 changed files with 17 additions and 7 deletions

View file

@ -77,8 +77,7 @@ public class ScoreController : ControllerBase
if (!score.PlayerIds.Contains(username))
{
this.Request.Body.Position = 0;
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
string bodyString = await this.ReadBodyAsync();
Logger.Warn("Rejecting score upload, requester username is not present in playerIds" +
$" (user={username}, playerIds={string.Join(",", score.PlayerIds)}, " +
$"gameVersion={token.GameVersion.ToPrettyString()}, type={score.Type}, id={id}, slotType={slotType}, body='{bodyString}')", LogArea.Score);