You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sandra Parsick <sp...@web.de> on 2018/04/23 13:24:51 UTC

Need a ContentType with a case sensitive mimetype

Hello Mailinglist,

I have following problem: I use the method "ContentType.create" to
create a ContentType. The current implementation of this method
transforms the input mimetype to lower case. One of our clients accepts
only "Content-Type" Header as case-sensitive string. Unfortunately, we
and our customer have no possibilities to change the client
implementation in this case (some backward compatibilities etc). We know
that this client implementation doesn't follow the RFC spec.
Nevertheless, I can't use the factory method for creating the
ContentType. Instead, I have to build the Http Header with a
StringBuilder. This approach is very error-prone. So my question to you
is, is it possible to add a flag to ContentType factory method to avoid
the lower case transformation? If it's possible, I could prepare a Pull
Request for this issue.

Best regards,

Sandra Parsick


Re: Need a ContentType with a case sensitive mimetype

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2018-04-23 at 15:24 +0200, Sandra Parsick wrote:
> Hello Mailinglist,
> 
> I have following problem: I use the method "ContentType.create" to
> create a ContentType. The current implementation of this method
> transforms the input mimetype to lower case. One of our clients
> accepts
> only "Content-Type" Header as case-sensitive string. Unfortunately,
> we
> and our customer have no possibilities to change the client
> implementation in this case (some backward compatibilities etc). We
> know
> that this client implementation doesn't follow the RFC spec.
> Nevertheless, I can't use the factory method for creating the
> ContentType. Instead, I have to build the Http Header with a
> StringBuilder. This approach is very error-prone. So my question to
> you
> is, is it possible to add a flag to ContentType factory method to
> avoid
> the lower case transformation? If it's possible, I could prepare a
> Pull
> Request for this issue.
> 
> Best regards,
> 
> Sandra Parsick
> 

Hi Sandra

It, of course, would be possible but would it be wise to drag something
that is clearly not right into a general purpose library? 

In your particular case you might want to create an application
specific copy of ContentType and change its behavior as you deem fit.

Oleg 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org