空手道 api 测试中不存在必需的请求部分 'files'
iRequired request part 'files' is not present in karate api testing
当我尝试使用以下功能时,我收到 Required request part 'files' is not present
功能:验证产品是否由 API
正确退回
Background:
* url 'http://localhost:8080'
Scenario: Products are returned on post
Given path 'upload'
And multipart field files = read('test.txt')
When method post
Then status 200
And match $ == {error: false, bytesUploaded:'#notnull'}
请建议文件上传的正确解决方案或替代方案 api 测试
参考multipart file
文档:https://github.com/intuit/karate#multipart-file
Given path 'upload'
And multipart file files = { read: 'test.txt', filename: 'test.txt', contentType: 'text/plain' }
When method post
Then status 200
And match $ == { error: false, bytesUploaded: '#notnull' }
当我尝试使用以下功能时,我收到 Required request part 'files' is not present 功能:验证产品是否由 API
正确退回Background:
* url 'http://localhost:8080'
Scenario: Products are returned on post
Given path 'upload'
And multipart field files = read('test.txt')
When method post
Then status 200
And match $ == {error: false, bytesUploaded:'#notnull'}
请建议文件上传的正确解决方案或替代方案 api 测试
参考multipart file
文档:https://github.com/intuit/karate#multipart-file
Given path 'upload'
And multipart file files = { read: 'test.txt', filename: 'test.txt', contentType: 'text/plain' }
When method post
Then status 200
And match $ == { error: false, bytesUploaded: '#notnull' }