You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`serializers`|`Array`|`[]`| List of serializer definitions, each with a `regex` and a `serializer` function |
78
+
|`default`|`string`| — | MIME type to use when no serializer matches the `Accept` header. If omitted, unmatched requests receive a `406` response |
79
+
|`cacheSize`|`number`|`100`| Maximum number of distinct `Accept` header combinations to cache. Entries are evicted in LRU order once the limit is reached |
80
+
72
81
## Behavior
73
82
74
83
For each route, a SerializerManager is defined, which has both per-route and global serializer definitions.
@@ -77,6 +86,8 @@ The MIME type `application/json` is always handled by `fastify` if no serializer
77
86
78
87
If no `default` key is specified in configuration, all requests with an unknown `Accept` header will be replied to with a 406 response (a boom error is used).
79
88
89
+
Serializer selection results are cached by `Accept` header value using an LRU cache bounded by `cacheSize`. This prevents unbounded memory growth from attacker-controlled `Accept` header variants.
0 commit comments