Issue in passing Session values in .body(RawFileBody("A"))

171 views
Skip to first unread message

Silent Streamer10

unread,
May 14, 2021, 7:19:39 AM5/14/21
to Gatling User Group
Hi All,

I am using the Gatling 3.5.1 versions and observed the following.

1. I am posting a multipart form data request in Raw format to the server and when I enabled the log file, it is sent in Base64 format from Gatling. When I decoded it via base64 decoder online , I could see that the  Correlated session values are not substituted  and it is simply sent as such. 

2. When I tried to the do the same as above by importing this import io.gatling.core.body.RawFileBody  , I am getting this error Can't cast of type class java.lang.String into class io.gatling.core.body.ResourceAndCachedBytes.

Note: The substitution works fine with ElFilebody and StringBody but the server couldn't accept those format.

Kindly Help on this.

Regards,
Aravind G

Stéphane LANDELLE

unread,
May 14, 2021, 4:22:56 PM5/14/21
to gat...@googlegroups.com
Hi,

No idea what you're doing.
Please share some code, stacktraces, etc...

Logo Stéphane Landelle
Chief Technical Officer
twitter: @slandelle
site:
gatling.io




--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/6453fecf-a91d-40eb-a128-f17b16470f35n%40googlegroups.com.

Stéphane LANDELLE

unread,
May 14, 2021, 4:24:59 PM5/14/21
to gat...@googlegroups.com
OK, you're trying to do `body(new RawFileBody(???))` while the documentation clearly states `body(RawFileBody(???))` without the `new`.


Logo Stéphane Landelle
Chief Technical Officer
twitter: @slandelle
site:
gatling.io



Silent Streamer10

unread,
May 14, 2021, 11:21:31 PM5/14/21
to Gatling User Group
Hi Stephane,

Thanks for the reply.
No, I am using only the .body(RawFileBody("??")).
Please find the detailed observation below with the code trace

1. Scenario 1 ( Without import io.gatling.core.body.RawFileBody ) - Substitution of session values  not happening

object A {

    // First call from where I get the dynamic values and correlate it in the xml file given in request-bodies/xml

        .exec(http("A")
          .post(url + "/B")
          .headers(C)
          .body(RawFileBody("request-bodies/xml"))
          .check(status.is(200)))

}

2. Scenario 2 ( With  import io.gatling.core.body.RawFileBody )  ( rest of the code trace remains the same) 
Result - Unable to trigger the second request and getting the error Can't cast of type class java.lang.String into class io.gatling.core.body.ResourceAndCachedBytes.

I hope this will be helpful Stephane. 

Note: The substitution works fine with ElFilebody and StringBody but the server couldn't accept those format

Regards,
Aravind G

Stéphane LANDELLE

unread,
May 15, 2021, 8:01:56 AM5/15/21
to gat...@googlegroups.com
The whole point of RawFileBody is to be able to send a file as is, without any transformation. So it doesn't support EL expressions.


Logo Stéphane Landelle
Chief Technical Officer
twitter: @slandelle
site:
gatling.io



Silent Streamer10

unread,
May 17, 2021, 9:23:23 AM5/17/21
to Gatling User Group
Hi Stephane,

Thanks for the clarification. I thought of an workaround to replace the correlated values in the request file and replace it with the dynamic values by using some file operations before triggering the actual request.

Regards,
Aravind G

Reply all
Reply to author
Forward
0 new messages