【问题标题】:Jmeter request keeps giving 403 where postman works & browser worksJmeter请求不断给出403邮递员工作和浏览器工作的地方
【发布时间】:2019-08-07 18:58:12
【问题描述】:

我使用邮递员,我可以在状态为 200 的情况下完美运行请求

https://abc/api/

当我尝试 Jmeter 时,我不断收到 403 禁止

GET https://abc/api/

我明白了

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
</body>
</html>

采样器请求

Thread Name: 0-test1-1
Sample Start: 2019-07-22 11:07:12 PDT
Load time: 485
Connect Time: 378
Latency: 485
Size in bytes: 287
Sent bytes:236
Headers size in bytes: 153
Body size in bytes: 134
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 403
Response message: Forbidden


HTTPSampleResult fields:
ContentType: text/html
DataEncoding: null

我的响应标题是

HTTP/1.1 403 Forbidden
Server: aws../2.0
Date: Mon, 22 Jul 2019 18:13:06 GMT
Content-Type: text/html
Content-Length: 134
Connection: keep-alive

注意确定是不是

我还将端口设置为 443,因为它是 https

我能够获取 application/json 的内容类型,但仍然得到 403,我注意到我的内容长度为 0

【问题讨论】:

  • 不,该链接不会告诉我有关内容类型的信息

标签: jmeter


【解决方案1】:

我发现它确实是用户代理,我在标题管理器中强制我的 Jmeter 用户代理 --> Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 它工作了

【讨论】:

    【解决方案2】:

    也许您需要添加到请求的标头中 Content-Type: application/json

    【讨论】:

      猜你喜欢
      • 2020-05-18
      • 2021-09-24
      • 2019-10-02
      • 2020-07-10
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      相关资源
      最近更新 更多