POST 请求未显示在 Chrome DevTools 中 [英] POST request not showing up in Chrome DevTools

查看:81
本文介绍了POST 请求未显示在 Chrome DevTools 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 WhatsApp 网页时,当您发送消息时,不会显示任何请求,但消息仍会传递.为什么在网络选项卡中几乎没有任何请求的迹象?以及如何使其可见(如果它是隐藏的)??

When using WhatsApp web, when you send a message there are no requests showing up, but the message still delivers. Why are there literally no signs of any requests made in the networking tab?? And how to make it visible (if it's hidden)??

注意:它只发生在 WhatsApp 网页上.在其他网站上,它可以工作并显示 GET 和 POST 请求...

Note: It happens only on WhatsApp web. On other sites, it works and shows the GET and POST requests...

推荐答案

在调试从 Web 完成的网络请求时,这是一个常见的混淆源.通常,开发人员自上而下地查看这些网络请求,并假设最低的请求是最近发出的请求——因此假设请求必须在底部.对于普通"HTTP,这是正确的.但是,许多想要实时显示数据的应用都使用 WebSocket 与 API 进行通信.

This is a common source of conufsion when debugging networking requests done from the web. Normally, developers look at these network requests from top down and assume that the lowest one is the most recent request made - therefore assuming that the request must be at the bottom. For 'plain' HTTP this is correct. However, many apps that want to show data in real-time, use WebSockets to communicate with an API.

同样的事情发生在 Whatsapp 的 Web 版本中.只有像实际的 JavaScript 应用程序、图标等资产是使用纯 HTTP 加载的.然后,打开一个 WebSocket,例如通过它交换消息.

The same thing happens in the Web-version of Whatsapp. Only assets like the actual JavaScript-app, icons etc are loaded using plain HTTP. Then, a WebSocket is opened through which messages are exchanged for example.

要查看实际请求,请执行以下操作:

To see the actual request do the following:

  1. 打开 DevTools,转到网络标签
  2. 打开 Whatsapp 网站.确保在此步骤 (1) 中已经在录制!
  3. 过滤WS"在过滤栏中
  4. 只有极少数结果可供您点击调查
  5. 使用消息"选项卡检查此套接字
  6. 现在发送一条消息,您将看到一条名为 binary message 的消息,其中包含您的消息作为负载.
  1. Open DevTools, go to networking tab
  2. Open Whatsapp web. Make sure that at this step (1) is already recording!
  3. Filter for "WS" in the filtering bar
  4. There will be only very few results which you can click to investigate
  5. Inspect this Socket using the 'messages' tab
  6. Now send a message, you will see a message called binary message with your message as payload.

这篇关于POST 请求未显示在 Chrome DevTools 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆