如何使用 Jmeter 发送 Google API POST 请求?

How do I send a Google API POST request using Jmeter?

我以前从未使用过Jmeter。我一直在尝试使用 Jmeter 向 Google Vision API 发送 HTTP 请求 - 但它返回 FORBIDDEN (403) 错误。我的请求以及所需的响应采用 JSON 格式。
我附在下面:
a) HTTP 请求
b) 响应错误

除此之外,我在 HTTP Header 管理器中设置了:
Content-Type: application/json

附加请求有什么问题?
Request image..
Response error image

根据Authenticating to the Cloud Vision API article you might require to provide OAuth token, it can be done via HTTP Header Manager喜欢:

  • 姓名:Authorization
  • 值:Bearer YOUR_ACCESS_TOKEN

有关在 JMeter 测试中与受 OAuth 保护的 Web 应用程序交互的更多详细信息,请参阅 How to Run Performance Tests on OAuth Secured Apps with JMeter 文章。