iterate list of files and send it through protobuf, getting MalformedInputException

`

import scala.concurrent.duration._

import io.gatling.core.Predef._

import io.gatling.http.Predef._

import io.gatling.jdbc.Predef._

import java.io._

import java.nio.file.Files

import java.nio.file.Paths

import scala.util.Random

import scala.io.Source._

class PerftestSimulation extends Simulation {

var request_url = “http://localhost:4080

val gatlingProtocol = http

.baseURL(request_url)

val gatlingHeader = Map(

“”“Content-Type”"" → “”“application/x-protobuf”""

)

val gatlingQuery = scenario(“Sending messages”)

.exec(http(“gatling_query_request”)

.post("/annotate/")

.headers(gatlingHeader)

.body(ByteArrayBody(session => getByteArrayBody(session))))

setUp(

gatlingQuery.inject(

rampUsersPerSec(1) to (40) during(1 minutes),

constantUsersPerSec(40) during(1 minutes)

)

).protocols(gatlingProtocol)

val getByteArrayBody = (session: Session) => {

scala.io.Source.fromFile(0023e00c-7ae4-3654-8977-ce2d5712e005.html.bin.gz").map(_.toByte).toArray

}

}

`

I’m getting error, and couldn’t quite get it .

20:48:14.751 [ERROR] i.g.h.a.s.HttpRequestAction - ‘httpRequest-1’ failed to execute: Failed to build request: MalformedInputException: Input length = 1

20:48:14.892 [ERROR] i.g.h.a.s.HttpRequestAction - ‘httpRequest-1’ failed to execute: Failed to build request: MalformedInputException: Input length = 1

20:48:15.042 [ERROR] i.g.h.a.s.HttpRequestAction - ‘httpRequest-1’ failed to execute: Failed to build request: MalformedInputException: Input length = 1

Couldn’t quite get the meaning of the error, i’m referencing https://groups.google.com/forum/#!topic/gatling/7HlGbe3fMGg to build the structure.

The files I’m sending are protobuf data and gziped.

want to add more…

my version currently is running 2.3.1, and still getting error.
Not sure which part is wrong in my query builder.

My case is to iterate list of gziped file and send it to web service with content-encoding : application/x-protobuf.