模拟在jmeter的HTTP请求中卷曲--data-binary切换

时间:2014-12-24 09:45:35

标签: curl jmeter jmeter-plugins

我有一个正常工作的卷曲请求:

curl -H "Content-Type: application/octet-stream" -X POST --data-binary @sample.bin http://127.0.0.1:31415/test

sample.bin包含二进制数据。

在我的jmeter测试计划中,我将“sample.bin”存储在FILENAME中。这是我放入HTTP请求主体的内容:

${__eval( ${__FileToString(${FILENAME})})}

不出所料,这不成功。如何模拟--data-binary开关?

1 个答案:

答案 0 :(得分:0)

好吧,经过另外一次RTFM后,我发现如果it is a POST or PUT or PATCH request and there is a single file whose 'Parameter name' attribute (below) is omitted, then the file is sent as the entire body of the request, i.e. no wrappers are added

因此,将${FILENAME}置于"发送带有请求的文件"的文件路径下。部分(虽然将其参数名称留空并指定编码)为我做了诀窍:

enter image description here