Open chalkpe opened 2 years ago
This sounds like a very sensible request, especially since you sometime can't control what charsets are used to upload text.
I would probably limit it to 'utf8'
by default, but allow other charsets through a boolean option, and possibly an allow list.
FYI, this will also require @hapi/content
to be updated, to actually parse and return the charset
parameter.
I don't know if there is anyone that are available to implement such a feature. But I would be happy to review a PR from you.
Support plan
Context
17.9.0
7.0.3
What problem are you trying to solve?
Parser doesn't do anything with
Content-Type
header withcharset
directive. It only parses payload buffer byutf8
, hardcoded. Only way to process non-UTF-8 payload is disable internal parser viaroute.options.payload.parse: false
and decode raw buffer manually, losing all benefits from hapi framework.Do you have a new or modified API suggestion to solve the problem?
charset
directive, or create an option for custom payload decoder.internals.object
is ignoring charset part ofContent-Type
header and stick with stringify payload buffer byutf8
encoding (text, json, form)