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

@ -182,8 +182,9 @@ public class UserController : ControllerBase
User? user = await this.database.UserFromGameToken(this.GetToken());
if (user == null) return this.StatusCode(403, "");
string pinsString = await new StreamReader(this.Request.Body).ReadToEndAsync();
Pins? pinJson = JsonSerializer.Deserialize<Pins>(pinsString);
string bodyString = await this.ReadBodyAsync();
Pins? pinJson = JsonSerializer.Deserialize<Pins>(bodyString);
if (pinJson == null) return this.BadRequest();
// Sometimes the update gets called periodically as pin progress updates via playing,