Discussion:
Need a ContentType with a case sensitive mimetype
Sandra Parsick
2018-04-23 13:24:51 UTC
Permalink
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
Oleg Kalnichevski
2018-04-23 14:53:16 UTC
Permalink
Post by Sandra Parsick
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-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Loading...