Search code examples
javahttpjmetermime-typescontent-type

Sending vendor content type with jMeter throws IllegalArgumentException


I need to add a custom content-type to a file uploaded with a multipart request. To do this, I put vendor content-type application/vnd.anything.process+json;ver=1 as a MIME type for this file. Unfortunately, jMeter throws IllegalArgumentException, because it recognizes ; as an invalid character in the content-type specification.

If this is not supported, then how to send a file with a content-type that contains ;? I tried to use a postman and record outgoing HTTP call from jMeter, but it fails with the same exception.

enter image description here

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:229)
    at org.apache.http.entity.ContentType.create(ContentType.java:241)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.setupHttpEntityEnclosingRequestData(HTTPHC4Impl.java:1575)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:886)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:635)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.base/java.lang.Thread.run(Thread.java:830)

Solution

  • I got confirmation, it is a bug in JMeter https://bz.apache.org/bugzilla/show_bug.cgi?id=65024