Skip to content

charset=utf8 inserted between two phrase media type in response header #2830

Description

@nicholasf

Hi,

Express is mangling the response header I'm trying to set for a two phrase media type

We are establishing a HATEOAS convention where we have a generic collection type, designated as a vnd, and various media types which might be collected there, also a vnd.

res.set('content-type', 'application/vnd.samcorp.collection;content="application/vnd.samcorp.foo"');

Read this as - we are sending you a samcorp collection of samcorp.foos.

Express renders the header as:

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/vnd.samcorp.collection; charset=utf-8; content="application/vnd.samcorp.foo"
...

Is there a way I can get rid of the intruding charset header?

It's worth noting that I had to do a lot of googling to discover how to include the content specifier. Using what is below results in an invalid parameter error from Express, so the double quotations in what was above became necessary.

 res.set('content-type', 'application/vnd.samcorp.collection;content=application/vnd.samcorp.foo');

Thanks,
Nicholas

Metadata

Metadata

Assignees

Type

No type
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