如何在PUT请求中发送认证参数 - Jmeter

How to send authentication parameters in PUT request - Jmeter

正在尝试使用Jmeter 工具进行负载测试,但无法通过身份验证。 以下卷曲效果很好

curl -u <USERNAME>:<PASSWORD> -X PUT "http://server-url/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt

我需要根据上面的 curl 示例通过 PUT 方法上传文件,但不能这样做,因为不明白用户名和密码值应该放在 HTTP 请求采样器中的什么位置,在参数部分,Post 正文或其他地方。

谢谢

猜测,但您可能添加了 HTTP header

Authentication: basic [base64 of username:password]

Google "HTTP Basic Authentication"

您需要在您的测试计划中添加一个 HTTP Authorisation Manager 并配置如下:

  • 基地URL:http://server-url
  • 用户名:USERNAME
  • 密码:PASSWORD

JMeter 将生成相关的 Authorization header and add it to the request. See How to Use HTTP Basic Authentication in JMeter 文章以获取更多详细信息。