Skip to content

JMeter failing for multipart/form body #137

@rplati

Description

@rplati

Hi, first of all thanks for your work on this package! I got it working and it looks very promising.

I was unable to test my API with JMeter due to tests failing when the API accepts multipart/form data.

I suspect this might be because the boundary that JMeter uses that does not start with double dash signs (--). It seems parse_multipart_body cannot handle that. When I submit the same call with Postman (boundary starts with --), everything works.

Partial JMeter log:

2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "POST /processData HTTP/1.1[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Connection: keep-alive[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Length: 708[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Type: multipart/form-data; boundary=ZI6zx6lhyfOL4qenewl6bZazXipXjA6nR31oGZ6[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Host: 127.0.0.1:5015[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "User-Agent: Apache-HttpClient/4.5.10 (Java/1.8.0_201)[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "--ZI6zx6lhyfOL4qenewl6bZazXipXjA6nR31oGZ6[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Disposition: form-data; name="rules"; filename="rules.txt"[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Type: text/plain[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Transfer-Encoding: binary[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "descriptionCleaned = str_trim(description),[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "volume = ifelse(str_trim(description) == 'prism', round(baseArea * height, 2), ifelse(str_trim(description) == 'pyramid', round(baseArea * height / 3, 2), NA))"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "--ZI6zx6lhyfOL4qenewl6bZazXipXjA6nR31oGZ6[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Disposition: form-data; name="dta"; filename="geo.csv"[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Type: text/csv[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "Content-Transfer-Encoding: binary[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> ""description","baseArea","height"[\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> ""  X",93.3,12.21[\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> ""pyramid",32.9,7.38[\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> ""  prism ",51.1,26.98[\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> ""pyramid",45.7,9.15[\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.h.wire: http-outgoing-44 >> "--ZI6zx6lhyfOL4qenewl6bZazXipXjA6nR31oGZ6--[\r][\n]"
2020-04-06 09:27:03,663 DEBUG o.a.j.p.h.s.HTTPHC4Impl: Sent 945 bytes
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "HTTP/1.1 500 Evaluation error[\r][\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "Connection: close[\r][\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "Content-type: text/plain[\r][\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "[\r][\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "Error in parse_multipart_body(body, paste0("--", boundary)) : [\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.wire: http-outgoing-44 << "  Boundary string not found.[\n]"
2020-04-06 09:27:03,669 DEBUG o.a.h.headers: http-outgoing-44 << HTTP/1.1 500 Evaluation error
2020-04-06 09:27:03,669 DEBUG o.a.h.headers: http-outgoing-44 << Connection: close
2020-04-06 09:27:03,669 DEBUG o.a.h.headers: http-outgoing-44 << Content-type: text/plain

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions