Unable to resolve data from the feeder file

Hi Team,
Our application uses encoded values( base64 bit encoding) , so we have used a method as below

def encodeData(data: String): String = {
java.util.Base64.getMimeEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8))
}

When we use same to method in scripts

.feed(loginUserFeeder)
.exec(

.formParam(“data”,encodeData("""{“tbl0”:{“csrfToken”:"${“UserName”}"}}"""))

)

User name is not getting resolved with feeder value.

feeder has value “ABC”.

After encoding we are getting value as “eyJ0YmwwIjp7ImNzcmZUb2tlbiI6IiR7IlVzZXJOYW1lIn0ifX0=” which is nothing but {“tbl0”:{“csrfToken”:"${“UserName”}"}}, we are expecting {“tbl0”:{“csrfToken”:“ABC”}}

Can any one please help us on this

Hi team,

I dint get any reply on my query, Let me know if i need to explain bit more clearly.

Regards
Ajith shetty

we have changed encode method with below lines.

def encodeData(session: Session, data: String): String = {
var lData = StringBody(data).apply(session)
var lData2 = lData.toString
lData2 = lData2.substring(8, lData2.length-1)

java.util.Base64.getMimeEncoder().encodeToString(lData2.getBytes(StandardCharsets.UTF_8))
}

Hi Ajit,

Does this worked for you as I am running in same boat and unable to perform encode. Below is the for parameter which I am planning to feed from CSV file.

.basicAuth(“H5BviauSmX4ZXAXHW3fhgfhfhfhuytku”,“VD2wNXxGBLuhikhjftafhvg”), These 2 values I will feed from and that base 64 value should passed in request header.

Please let me know how you fixed encoding to base 64.

Thanks in advance.