Skip to content

Support subtypes in Content-Type #541

Description

@phxql

Hi,

i can't set the Content-Type header to Content-Type=audio/wav; codec="audio/pcm"; samplerate=16000 as i get the following exception:

Caused by: java.lang.IllegalArgumentException: MIME type may not contain reserved characters
	at org.apache.http.util.Args.check(Args.java:36) ~[httpcore-4.4.5.jar:4.4.5]
	at org.apache.http.entity.ContentType.create(ContentType.java:182) ~[httpcore-4.4.5.jar:4.4.5]
	at feign.httpclient.ApacheHttpClient.getContentType(ApacheHttpClient.java:159) ~[feign-httpclient-9.3.1.jar:na]

Problem is this line in feign.httpclient.ApacheHttpClient#getContentType:

contentType = ContentType.create(entry.getValue().iterator().next(), request.charset());

The ContentType.create() method doesn't support sub-types, but ContentType.parse() does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions