How to implement jmeter request message from cURL command

I need to implement 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 must indicate a value <Client Id>:<Client Secret>

. The assertion parameter must specify a SAML2.0 assertion encoded in base64url.

How do I evaluate the -u and -d parameter in a jmeter request? I am trying to use the HTTP Header Manager as shown below:

Content-Type: application/x-www-form-urlencoded;charset=UTF-8
client_id: Oezvjl4Ffju8Y0sLTXwfTuUHyHMa
code: vwe7v7AaontzlOfiefCRjrYWpUwa


and i put grant_type=...

in http post request body data .. but it doesn't work.


source to share

1 answer

Easy way: - just record the call.

  • Run Test JMeter HTTP (S) Script Recorder
  • In the shell:
    • export http_proxy=http://localhost:8080/

    • curl .......

The captured request will be under the Recording Controller .

A tougher way: - if you want total control

The JMeter equivalent would look like this:

HTTP Request Configuration:

  • Server name or IP: $host

  • Protocol: https

  • Method: POST

  • Content encoding: UTF-8

  • Way: /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



All Articles