简体   繁体   中英

How to convert the said curl to equivalent scala Gatling code?

Please help in how to convert below curl to equivalent scala Gatling code?

            curl --location --request POST 'https://test.salesforce.com/services/oauth2/token' \
            --header 'Content-Type: application/x-www-form-urlencoded' \
            --header 'Cookie: BrowserId=DbIfsfsf' \
            --data-urlencode 'username=webapi@abc.com.uat1' \
            --data-urlencode 'client_id=xxx' \
            --data-urlencode 'client_secret=xxxx' \
            --data-urlencode 'grant_type=password' \
            --data-urlencode 'password=xxxx'

Here there are all answers on your question https://gatling.io/docs/current/http/http_request


val myRequest = http("my request")
    .post("https://test.salesforce.com/services/oauth2/token")
    .header(HttpHeaderNames.ContentType, HttpHeaderValues.ApplicationFormUrlEncoded)
    .header("Cookie", "BrowserId=DbIfsfsf")
    .formParam("username", "webapi@abc.com.uat1")
    .formParam("client_id", "xxx")
    .formParam("client_secret", "xxxx")
    .formParam("grant_type", "password")
    .formParam("password", "xxxx")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM