upload.feature
,但空手道似乎只允许多部分表单请求。Scenario: Successul
* karate.log(token, auth, common_headers)
Given url 'https://webhook.site/e026040f-68ac-45e9-8add-c839fd46f0ba'
And multipart field image = read('images/img1.png')
And header Content-Type = 'image/png'
When method PUT
Then status 200
curl
命令(来自 Postman)curl --location --request PUT 'https://staging-ah.naluri.net/food-journal/upload?x-pri-id=qedSdhZU7UmXXztqFJyJw&x-verify-id=P2KUBtR07Qqk3j6U7tGrG' \
--header 'Content-Type: image/png' \
--form 'file=@"/Users/dennis.dao/workspace/repo/sample/karate-ui-sample/images/img1.png"'
curl --location --request PUT 'https://staging-ah.naluri.net/food-journal/upload?x-pri-id=qedSdhZU7UmXXztqFJyJw&x-verify-id=P2KUBtR07Qqk3j6U7tGrG' \
--header 'Content-Type: image/png' \
--data '@images/img1.png'
我找到了解决方案:
Scenario: Successul
Given url 'https://webhook.site/e026040f-68ac-45e9-8add-c839fd46f0ba'
And header Content-Type = 'image/png'
* def image = read('images/img1.png')
And request image
When method PUT
Then status 200
When method PUT
Then status 200