如何等待并获得.net剧作家中的最后一个回应

发布于 2025-02-13 18:54:09 字数 425 浏览 0 评论 0原文

请帮助我解决这个问题。我有需要获得同一API调用的最后一个响应的情况,但这是异步调用,我不知道该如何处理。问题在于,我可以对相同的“ API/SOMEE​​VENT”提出多个请求,但是我只需要验证最后一个的响应数据。

var postData;

page.Response += (_, response) =>
{
  if (response.Url.Contains('API/someEvent'))
  {
    postData = response.Request.PostData;
  }
};

if (isDataValid(postData)) {
 return true;
} else {
 return false;
}

private Task<bool> isDataValid(){}

任何建议都会非常有帮助!

Please help me to sole this problem. I have the case where I need to get the last response of the same API call, but it's async call and I don't know how to handle this. The problem is that I can have more than one requests for the same 'API/someEvent' but I need to validate the response data of the last one only.

var postData;

page.Response += (_, response) =>
{
  if (response.Url.Contains('API/someEvent'))
  {
    postData = response.Request.PostData;
  }
};

if (isDataValid(postData)) {
 return true;
} else {
 return false;
}

private Task<bool> isDataValid(){}

Any advice would be very helpful thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文