RawFileBody not outputting text

I’m new to Gatling, working on writing my first scenario. I can’t get RawFileBody to work. I direct all traffic through fiddler so I can see what’s going on and the file content isn’t being outputted to the request body. Using StringBody works fine but I prefer not using it for very large JSON payloads.

I’ve checked that the file is in the “…\gatling\gatling-charts-highcharts-bundle-2.1.4\user-files\bodies” directory, I’ve tried using an absolute path, I’ve tried adding asJSON. I’ve set log levels to trace and haven’t seen any errors or warnings, but the request body is still empty. Here’s the relevant part of the script (ignore any small mistakes as I’ve had to remove lots of proprietary code):

import io.gatling.core.scenario.Simulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._

import java.util.UUID

class Scenario1 extends Simulation {

  val uri1 = "http://somehost"

  val httpProtocol = http
    .baseURL("http://somehost")
    .proxy(Proxy("localhost", 8888).httpsPort(8888))
    .inferHtmlResources()
    .acceptHeader("application/json")
    .contentTypeHeader("application/json")

  val header = Map("Some" -> "proprietary-header")

  object Foo {
    val bar = exec(http("bar")
      .post(uri1 + "/app/myservice")
      .headers(header)
      .body(RawFileBody("my_request.txt")))
  }

  val scn = scenario("scenario1").exec(Foo.bar)

  setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}

Any ideas?

Hi Jonathan,

No, I don’t see any reason for RawFileBody not to work, your sample looks fine.
By any chance, have you tried reproducing with 2.1.5 that we’ve released today?

Then, how does the request behave without Fiddler? Does your application properly receive the request payload?

Hi Stephane, so it does seem to have to do with the proxy configuration. When I don’t direct gatling through fiddler everything works as expected. I’ve updated to the new 2.1.5 release and the behavior is the same. Is it an issue with streaming the file to the proxy?

Regards,
Joni

I’ve tested posting a RawFileBody through a proxy, both over HTTP and HTTPS.
I used Charles (which is great, and I don’t run on Windows so no Fiddler for me) and could log the body in both cases.

Are you sure that’s not a Fiddler bug?
Could you give Charles a chance, please?

Cheers,

Hן Stephane, from what I’m seeing Charles is not free. I might try the trial out just to check this at some point, but otherwise it’s not a workaround that I can use right now. I’ll update you if I find out anything new.