formUpload - change MIME type

formUpload is just a utility that wraps a RawFileBodyPart + asMultipartForm

so this will work, I guess

.bodyPart(RawFileBodyPart("file", data.xls").contentType("application/vnd.ms-excel").fileName("data.xls"))
.asMultipartForm

thanks

that should go on the documentation

Done :slight_smile:
https://github.com/gatling/gatling/commit/0dbe4dc6bd034621c1a9add5e4163dc8977c9e87

But how to upload the file for put operation…This is not working for put…What may be the solution in gatling 2.0

Send your code that is not working.

Thanks john,Here I am giving my code…

.exec(http(“PUT_call”)
.put("/users/posts/${postid}")
.headers(put_header)
.formParam(“title”, “Post with gatling”)
.formParam(“content”, “Content of pos”)
.formParam(“author”, “user12”))

And previously I got advice thta formParam will work for gatling 2.1…But I don’t know how to do that…presently I am using gatling 2.0…So If that is the only solution please tell me the

Step by Step procedure to migrate…Actually In my case formParam and formUpload is not at all working…Please help me with detail solution…As per my api I need only formParam…

Thanks

So, what you are going to have to do is choose one of these two options:

  1. Upgrade to Gatling 2.1
  2. Figure out how to build the body of the PUT request manually

If you can’t make option 1 work, then start here for option 2: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1

John…I know about forms…But what is the syntax to provide form to gatling???

Look at the format that it gets sent to the server in. Any reason why you can’t give it to Gatling exactly like that?