Reputation: 99
How to encode input filed "fileData"(from CSV) and use it as input parameter like ${fileData}
below is the ex- fileData input should be converted like=
{"fileData":"QkVOLCxIb21lQmFuajc2MjkxNzI2MTcxOTU0MjI1OTQ5ODkxNjIzMjI0ODUyODI3NjI5MTcyNjE3MTk1NDIyNTk0OTg5MTYyMzIyNDg1MjgyQVZJMSwsSG9tZUJhbmtqNjI5MTcyNjE3MTk1NDIyNTk0OTg5MTYyMzIyNDg1MjgyNzYyOTE3MjYxNzE5NTQyMjU5NDk4OTE2MjMyMjQ4NVJFQ09SREEsLGFkZHJlc3MsLCwsLCwsLCwsLERTQVMyLCwsLCwsLCwsLCwsLCwsLCwsLFksLCwsLCwsLCwsLCwsLE4sLCwsLCwsLCwsLERTQVMyLCwsQ0=="
POST data: {"fileData":""${fileData}","fileName":"JMETER1.txt","fileDescription":"testing file upload with single data","isEncrypted":"N","encryptionDetails":{"algorithm":"","secretKey":"","signatureBytes":""},"valMode":"N"}
Upvotes: 0
Views: 755
Reputation: 168122
You need to encode the data from your CSV file in Base64
There is __base64Encode() function which can do the trick for you:
Your request syntax should look like:
{
"fileData": "${__base64Encode(${fileData},)}",
"fileName": "JMETER1.txt",
"fileDescription": "testingfileuploadwithsingledata",
"isEncrypted": "N",
"encryptionDetails": {
"algorithm": "",
"secretKey": "",
"signatureBytes": ""
},
"valMode": "N"
}
and variable substitution will happen in the runtime:
You can install __base64Encode() function along with other Custom JMeter Functions using JMeter Plugins Manager
Upvotes: 1