body curl命令测试post_如何从cURL命令实现jmeter请求post

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 : 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.

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:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值