Hi All
I am pretty new to Scala.
I am actually currently writing the gatling load script to perform some tests.
In my script, this works for our backend URL:
.post("our_url")
.bodyPart(RawFileBodyPart("A_VALID_FILE"))
.check(
status.is(200),
regex("<code>I0008</code").exists
))
And I am trying to do this and it is not working:
.post("our_url")
.bodyPart(ELFileBody("A_XML_TEMPLATE"))
.check(
status.is(200),
regex("<code>I0008</code").exists
))
How can I switch ELFileBody to be similar to RawFileBodyPart for my scenario?
Thanks for any help.
Ian Lim
XXXBody => full body
XXXBodyPart => multipart part
So what you want is not ELFileBody but… http://gatling.io/docs/2.1.3/http/http_request.html#multipart-request
Hi All
This snippet is also not working for my case:
.post("our_url")
.bodyPart(ELFileBodyPart("A_XML_TEMPLATE"))
.check(
status.is(200),
regex("<code>I0008</code").exists
))
In the backend, the struts actions is actually doing this:
InputStream inputStream = ServletActionContext.getRequest().getInputStream();
Regards
Ian Lim
For those who struggled like me:
Here is the final code which can be accepted by
InputStream inputStream = ServletActionContext.getRequest().getInputStream();
The final code:
.post("A_STRUTS_ACTION.do")
.body(ELFileBody("THE_XML_FILE"))
.check(
status.is(200),
regex("<code>I0008</code").exists
).asMultipartForm)
Regards
Ian Lim
Basically, Struts expects a multipart/form-data Content-Type in order to trigger this code branch.