fix: Add snake_case JSON deserialization for Telegram API response
All checks were successful
Build and Deploy LittleShop / Deploy to Production VPS (Manual Only) (push) Has been skipped
Build and Deploy LittleShop / Deploy to Pre-Production (CT109) (push) Successful in 1m0s

The Telegram API returns JSON with snake_case properties (first_name, is_bot)
but the DTOs use PascalCase. Added JsonSerializerOptions with
PropertyNameCaseInsensitive and SnakeCaseLower naming policy.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
SysAdmin 2025-11-25 16:50:47 +00:00
parent 521bff2c7d
commit f367a98c53

View File

@ -567,7 +567,12 @@ public class BotManagerService : IHostedService, IDisposable
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
var responseJson = await response.Content.ReadAsStringAsync(); var responseJson = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<TelegramGetMeResponse>(responseJson); var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
};
var result = JsonSerializer.Deserialize<TelegramGetMeResponse>(responseJson, options);
return result?.Result; return result?.Result;
} }
else else