-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Is your feature request related to a problem? Please describe.
Possible solution for #1438, better thought of and more maintainable than #1687.
Describe the solution you'd like
A custom hook that lets the user determine how the body of a request/response should be parsed based on its mime type.
The hook receives the mime type or the request/response headers as input and returns a value from an enum, telling the framework how to interpret the body.
Describe alternatives you've considered
- Two fields in the
svelte.config.jsfile (one for buffer and other for text) that contain a list of regexes that are tested against a mime type to determine how the body should be parsed. - Hardcoded list of mime types for body parsing.
How important is this feature to you?
For me is a very important feature since it will enable users to send binary content from endpoints, and let them define specific handling for some mime types such as image/svg+xml.
Additional context
This feature requires svelte kit to make hooks accessible to adapters.
This feature was made considering that #1563 may become a part of the framework hence the use of an enum instead of a boolean.
This feature is also intended to replace #1687.