如何从cURL命令实现jmeter请求post [英] how to implement jmeter request post from a cURL command
问题描述
我需要从这个cURL命令实现一个jmeter脚本:
curl -X POST -uOezvjl4Ffju8Y0sLTXwfTuUHyHMa:vwe7v7AaontzlOfiefCRjrYWpUwa
-HContent-Type:application / x-www-form-urlencoded; charset = UTF-8
-dgrant_type = urn:ietf:params:oauth:grant-type:saml2- bearer& assertion = PD94bWwgd ....
-k https:// $ host / oauth2 / token
-u标志应指定< Client Id>:< Client Secret>
值。断言参数应该指定base64url编码的SAML2.0断言。
如何评价jmeter请求中的参数-u和-d?
我尝试使用HTTP头管理器如下:
Content-Type:application / x-www-form-urlencoded ; charset = UTF-8
client_id:Oezvjl4Ffju8Y0sLTXwfTuUHyHMa
code:vwe7v7AaontzlOfiefCRjrYWpUwa
我把 grant_type = ...
放在http post请求的主体数据..但它不工作。
更简单的方式: - 仅记录通话。
- 启动 JMeter的HTTP(S)测试脚本记录器
- 在shell中:
-
export http_proxy = http:// localhost:8080 /
-
curl .......
-
捕获的请求将位于录制控制器。
更难的方式: - 如果您想完全控制
如下:
HTTP请求配置:
- 服务器名称或IP:
$ host
- 协议:
code>
- 方法:
POST
- 内容编码:
UTF-8
- 路径:
/ oauth2 / token
- 正文数据:
grant_type = urn:ietf:params:oauth:grant-type:saml2-bearer& assertion = PD94bWwgd ....
HTTP标题管理器配置:
- 名称:
授权
- 价值:
基本T2V6dmpsNEZmanU4WTBzTFRYd2ZUdVVIeUhNYTp2d2U3djdBYW9udHpsT2ZpZWZDUymyWVdwVXdh
I need to implement a jmeter script from this cURL command:
curl -X POST -u "Oezvjl4Ffju8Y0sLTXwfTuUHyHMa:vwe7v7AaontzlOfiefCRjrYWpUwa"
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"
-d "grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer&assertion=PD94bWwgd...."
-k https://$host/oauth2/token
The -u flag should specify the <Client Id>:<Client Secret>
value. The assertion parameter should specify the base64url encoded SAML2.0 assertion.
How do I value the parameter -u and -d in jmeter request? I try using HTTP Header Manager as below:
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
client_id: Oezvjl4Ffju8Y0sLTXwfTuUHyHMa
code: vwe7v7AaontzlOfiefCRjrYWpUwa
and I put grant_type=...
in the body data of http post request.. but it doesn't work.
Easier way: - just record the call.
- Launch JMeter's HTTP(S) Test Script Recorder
- In shell:
export http_proxy=http://localhost:8080/
curl .......
Captured request will be under Recording Controller.
Harder way: - if you want complete control
JMeter equivalent will look as follows:
- Thread Group
HTTP Request Configuration:
- Server Name or IP:
$host
- Protocol:
https
- Method:
POST
- Content encoding:
UTF-8
- Path:
/oauth2/token
- Body data:
grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer&assertion=PD94bWwgd....
HTTP Header Manager Configuration:
- Name:
Authorization
- Value:
Basic T2V6dmpsNEZmanU4WTBzTFRYd2ZUdVVIeUhNYTp2d2U3djdBYW9udHpsT2ZpZWZDUmpyWVdwVXdh
这篇关于如何从cURL命令实现jmeter请求post的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!