Hi, I am getting this browser console error if the mainGameId parameter is null:
POST https://example.com/api/devConnection/66544/jwt/null 500
But in my controller, I am checking it for null in here:
[HttpPost("{id}/Jwt/{mainGameId}")]
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public JsonResult Jwt(Int32 id, Int32? mainGameId)
{
var game = GameCollection.Get(id);
var gameTitle = game.Title;
string token;
if(mainGameId.HasValue)
{
token = CommUtils.GenerateValidToken(mainGameId.ToString(), gameTitle);
}
else
{
token = CommUtils.GenerateValidToken(id.ToString(), gameTitle);
}
return Json(new { token });
}
But even with that check, I still get the error above.
Is there any other type of check I need to do?
Thanks!