diff --git a/samples/SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5/Controllers/WechatNotifyController.cs b/samples/SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5/Controllers/WechatNotifyController.cs index dd9ec531..3f562d46 100644 --- a/samples/SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5/Controllers/WechatNotifyController.cs +++ b/samples/SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5/Controllers/WechatNotifyController.cs @@ -48,11 +48,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Controllers // 文档:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html var client = _wechatApiHttpClientFactory.Create(appId); - bool valid = client.VerifyEventSignature( - callbackTimestamp: timestamp, - callbackNonce: nonce, - callbackSignature: signature - ); + bool valid = client.VerifyEventSignatureForEcho(callbackTimestamp: timestamp, callbackNonce: nonce, callbackSignature: signature); if (!valid) { return Content("fail"); diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/WechatApiEventDeserializationTests.cs b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/WechatApiEventDeserializationTests.cs index 70f49b4e..31d20646 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/WechatApiEventDeserializationTests.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/WechatApiEventDeserializationTests.cs @@ -16,9 +16,12 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests string xml = "13488318601234567890123456"; var xDoc = XDocument.Parse(xml); - string @event = xDoc.Root!.Element("MsgType")!.Value.ToUpper(); + string msgType = xDoc.Root!.Element("MsgType")!.Value; - Assert.Equal("TEXT", @event); + Assert.Equal("TEXT", msgType, ignoreCase: true); + + var eventModel = TestClients.Instance.DeserializeEventFromXml(xml); + Assert.Equal("TEXT", eventModel.MessageType, ignoreCase: true); } [Fact(DisplayName = "反序列化 TEXT 事件")]