How to send file with parameter in mime type

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to send file with parameter in mime type

Łukasz Pyrzyk
Hello,

I try to send a file with multipart/form-data with mime type "text/html;
charset=UTF-8" and it fails with an exception

java.lang.IllegalArgumentException: MIME type may not contain reserved
characters
    at org.apache.http.util.Args.check(Args.java:36)

It looks like ";" is forbidden for mime type, where according to docs, it's
perfectly fine to have it. https://en.wikipedia.org/wiki/Media_type

I tried to switch implementation to the Java, but this implementation does
not support local path, or I simply don't know how to construct it.

How to fix the problem?

--

*Łukasz Pyrzyk*

Co-founder of the Dotnetos.org <https://dotnetos.org>

Software Engineer • Speaker  • Lecturer

Blog <https://pyrzyk.net/> | Twitter <https://twitter.com/lukaszpyrzyk> |
LinkedIn <https://www.linkedin.com/in/lukaszpyrzyk/> | GitHub
<https://github.com/lukaszpyrzyk> |
Reply | Threaded
Open this post in threaded view
|

Re: How to send file with parameter in mime type

Felix Schumacher
This is probably because we use the "wrong" method to parse/create the
Contenttype in JMeter.

I think, we should switch to using ContentType#parse(String) instead of
#create(String).

Would you mind opening a bug report for this?

Regards

 Felix


Am 22.12.20 um 12:02 schrieb Łukasz Pyrzyk:

> Hello,
>
> I try to send a file with multipart/form-data with mime type "text/html;
> charset=UTF-8" and it fails with an exception
>
> java.lang.IllegalArgumentException: MIME type may not contain reserved
> characters
>     at org.apache.http.util.Args.check(Args.java:36)
>
> It looks like ";" is forbidden for mime type, where according to docs, it's
> perfectly fine to have it. https://en.wikipedia.org/wiki/Media_type
>
> I tried to switch implementation to the Java, but this implementation does
> not support local path, or I simply don't know how to construct it.
>
> How to fix the problem?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to send file with parameter in mime type

Łukasz Pyrzyk
Hi,

Thanks for the response and confirmation. I've created a bug
https://bz.apache.org/bugzilla/show_bug.cgi?id=65024.

Best regards
Łukasz

On Tue, Dec 22, 2020 at 12:25 PM Felix Schumacher <
[hidden email]> wrote:

> This is probably because we use the "wrong" method to parse/create the
> Contenttype in JMeter.
>
> I think, we should switch to using ContentType#parse(String) instead of
> #create(String).
>
> Would you mind opening a bug report for this?
>
> Regards
>
>  Felix
>
>
> Am 22.12.20 um 12:02 schrieb Łukasz Pyrzyk:
> > Hello,
> >
> > I try to send a file with multipart/form-data with mime type "text/html;
> > charset=UTF-8" and it fails with an exception
> >
> > java.lang.IllegalArgumentException: MIME type may not contain reserved
> > characters
> >     at org.apache.http.util.Args.check(Args.java:36)
> >
> > It looks like ";" is forbidden for mime type, where according to docs,
> it's
> > perfectly fine to have it. https://en.wikipedia.org/wiki/Media_type
> >
> > I tried to switch implementation to the Java, but this implementation
> does
> > not support local path, or I simply don't know how to construct it.
> >
> > How to fix the problem?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--

*Łukasz Pyrzyk*

Co-founder of the Dotnetos.org <https://dotnetos.org>

Software Engineer • Speaker  • Lecturer

Blog <https://pyrzyk.net/> | Twitter <https://twitter.com/lukaszpyrzyk> |
LinkedIn <https://www.linkedin.com/in/lukaszpyrzyk/> | GitHub
<https://github.com/lukaszpyrzyk> |