提问人:Sunitha 提问时间:10/19/2023 最后编辑:Sunitha 更新时间:10/20/2023 访问量:81
无法在空手道中上传 Content-Type: application/x-java-serialized-object 的二进制文件
Unable to upload binary file with Content-Type: application/x-java-serialized-object in karate
问:
我们尝试运行的空手道脚本
Feature: getSummary
Background: Setup
* def constants = read(FEATURES_PATH + 'testfeatures/cc/hmm/common/MdsData.json')
* callonce read(FEATURES_PATH + 'testfeatures/bb/cc/common/test.feature')
* configure headers = ({'Content-Type': 'application/x-java-serialized-object','Accept': '*/*','Authorization': authCredentials,'Accept-Encoding': 'gzip,deflate,br','remoteUsername':'[email protected]', 'executeAsRemoteUserFlag':true,Accept:HEADER_ACCEPT, Connection:HEADER_CONNECTION})
Scenario: Binary content
Given url BASE_URL + '/txt/remote/Service/getSummary'
And request read('test.txt')
When method POST
Then status 200
答:
0赞
Peter Thomas
10/19/2023
#1
我唯一的建议是尝试这个 - 因为您正在使用二进制文件。不能将其视为纯文本。
And request karate.readAsBytes('test.txt')
评论
1赞
Sunitha
10/19/2023
非常感谢彼得,它像魅力一样工作!
0赞
Peter Thomas
10/19/2023
@Sunitha很高兴知道。请接受答案,以便帮助其他人: stackoverflow.com/help/someone-answers
评论