fix message.RequestHeaders

This commit is contained in:
Haiping Chen 2025-01-23 21:47:58 -06:00
parent 2159352daf
commit 3c1f1bba57

View file

@ -65,7 +65,7 @@ namespace BotSharp.Plugin.Twilio.Services
var httpContext = sp.GetRequiredService<IHttpContextAccessor>();
httpContext.HttpContext = new DefaultHttpContext();
httpContext.HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());
foreach (var header in message.RequestHeaders)
foreach (var header in message.RequestHeaders ?? [])
{
httpContext.HttpContext.Request.Headers[header.Key] = header.Value;
}