I am using gatling version <gatling.version>2.0.0-M3a</gatling.version> in my testing which need to upload an avi file to the server.
This curl is working fine for me:
curl -i -u admin:hEbzRirYJQFKYk -F “file1=@sample.avi” -F “file2=@video.json;type=application/json” https://servername/api/core/v3/contents
But when I tried the gatling script:
val headers_1 = Map(
“type” → “multipart/form-data”,
“Authorization” → “Basic YmFuemFpQGRvcml0b3NvZnR3YXJlLmNvbTpndWVzc21l”)
val postBodyString = “”"{“content”: {“type”: “text/html”, “text”: “
Here comes the body for a video
”},“parent”: “https://doritosoftware-banzai-8134-1-essential-plus.jivelandia.com/api/core/v3/places/1006”,
“subject”: “This is a test subject with video”,
“type”: “video”}"""
.post("/api/core/v3/contents")
.headers(headers_1)
.bodyPart(StringBodyPart(“json”, “${postBody}”, “utf-8”, contentType)) //, “UTF-8”, “1”))
.bodyPart(RawFileBodyPart(“binary”, “sample.avi”, “video/x-msvideo”))
.check(bodyString.saveAs(“bodyString”))
.check(status.is(200)))
I always get 500 and checking the server log, it seems like the attachment (avi file is null). Can you give me some advices?
Thx