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
{{ message }}
Repository navigation
Plugin api: raw-body mode for plugins that wrap node-style handlers #583
Split out of #206 (plugin-zero results comment): second seam forced by mounting Tideholm inside JSS.
Problem
Fastify's content parsers consume the request stream before handlers run. A plugin that hands requests to an existing node-style handler ((req, res) — any wrapped HTTP app, reverse proxy, or framework adapter) then blocks forever: the wrapped app listens for data/end on a stream that has already been drained. This cost an hour of debugging in the Tideholm adapter and will bite every plugin of this shape.
Workaround today (works, but is folklore)
Scoped registration with a pass-through parser, plus reply.hijack():
When the #206 loader lands, api.fastify (or a helper like api.mountApp(prefix, nodeHandler)) should offer this as a declared mode — e.g. rawBody: true in the plugin manifest or register options — so plugin authors never rediscover the scoped-parser incantation. api.mountApp is the stronger shape: it can bundle the prefix registration, the parser escape, the hijack, and the appPaths WAC exemption (see sibling issue) into one call, since every wrapped-app plugin needs all four together.
Acceptance
A plugin can declare/mount a node-style handler and receive unconsumed request bodies
Host content parsing unaffected outside the plugin's scope
Test: JSON POST through a mounted node handler round-trips (the exact Tideholm demo case)
Activity
bump version to 0.0.213
bump version to 0.0.214
bump version to 0.0.215
bump version to 0.0.216
bump version to 0.0.217
feat(plugins): api.mountApp for wrapped node-style apps (#583) (#590)
bump version to 0.0.218