如何使用空手道 post api 请求 Key:Value multipart/form-data
How to post a rest api request with Key:Value multipart/form-data using karate
我想要 post 一个 multipart/form-data 的请求。但它有 Key:value 对的主体。它在 Postman、soapui 和 parasoft soatest 中工作。下面是我试过的代码。
Given url 'http://localhost:8080/services/oauth2/token'
And multipart field username=username@usernmae
And multipart field password=secertePass
And multipart client_secret=98765432d1
And header Content-Type = 'multipart/form-data'
When method post
Then status 200
空手道错误:
com.intuit.karate.exception.KarateException: test.feature:9 - 未找到匹配的步骤定义方法:多部分字段 grant_type=密码
在✽.And multipart field grant_type=password (test.feature:9)
在 =
之前和之后不提供 space 可能会导致此问题,并且客户端密码中也会遗漏字段。
你试过了吗,
And multipart field username = username@usernmae
And multipart field password = secertePass
And multipart field client_secret = 98765432d1
我想要 post 一个 multipart/form-data 的请求。但它有 Key:value 对的主体。它在 Postman、soapui 和 parasoft soatest 中工作。下面是我试过的代码。
Given url 'http://localhost:8080/services/oauth2/token'
And multipart field username=username@usernmae
And multipart field password=secertePass
And multipart client_secret=98765432d1
And header Content-Type = 'multipart/form-data'
When method post
Then status 200
空手道错误: com.intuit.karate.exception.KarateException: test.feature:9 - 未找到匹配的步骤定义方法:多部分字段 grant_type=密码 在✽.And multipart field grant_type=password (test.feature:9)
在 =
之前和之后不提供 space 可能会导致此问题,并且客户端密码中也会遗漏字段。
你试过了吗,
And multipart field username = username@usernmae
And multipart field password = secertePass
And multipart field client_secret = 98765432d1