fix: Add snake_case JSON deserialization for Telegram API response
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:
parent
521bff2c7d
commit
f367a98c53
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user