Skip to content

feat: harden fetch route handling and add .all() method#18

Open
p-dubovitsky wants to merge 1 commit into
fastify:mainfrom
p-dubovitsky:harden-fetch-route-handling
Open

feat: harden fetch route handling and add .all() method#18
p-dubovitsky wants to merge 1 commit into
fastify:mainfrom
p-dubovitsky:harden-fetch-route-handling

Conversation

@p-dubovitsky

Copy link
Copy Markdown

Summary

This PR tightens @fastify/fetch route behavior, expands the routing API with fastify.fetch.all(), and improves package readiness for publishing.

Changes

  • Isolate raw body parsing to fastify.fetch.* routes so regular Fastify routes keep their normal content-type parsers.
  • Stream Response.body to replies instead of buffering the whole response.
  • Build Request.url from Fastify request.protocol, request.hostname, and request.url, including trustProxy behavior.
  • Add fastify.fetch.all(path, handler).
  • Add TypeScript support and type tests for fetch.all().
  • Add regression tests for parser isolation, streaming bodies, forwarded protocol URLs, and fetch.all().
  • Add package metadata hardening with engines.node and a publish files whitelist.
  • Update README for the new API.

Checklist

Signed-off-by: Pavel Dubovitsky <p.a.dubovitsky@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant