+
Skip to content

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Jul 30, 2025

Followup on #1096 with app.fetch(req) becoming more restricted, it makes sense we make app.request(req, init, ctx) a public API to unblock DX limits.

Other API change: Types are now Response | Promise<Response> to reduce unnecessary wrappings. (please comment if anyone feels this is a bad DX)

Copy link

cloudflare-workers-and-pages bot commented Jul 30, 2025

Deploying h3dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1344e7d
Status: ✅  Deploy successful!
Preview URL: https://117d2cd8.h3dev.pages.dev
Branch Preview URL: https://feat-app-req.h3dev.pages.dev

View logs

Copy link

codecov bot commented Jul 30, 2025

@pi0 pi0 merged commit 96a9453 into main Jul 30, 2025
3 checks passed
@pi0 pi0 deleted the feat/app-req branch July 30, 2025 12:26
@huseeiin
Copy link
Contributor

huseeiin commented Aug 1, 2025

yes i think it should be Promise<Response> to match globalThis.fetch. imagine someone making an SSR framework and they override globalThis.fetch so it works like SPA (similar to nuxt useFetch, P.S. i know useFetch is not overriding globalThis.fetch). users then will use fetch("/route").then(res => res.json()) and get fetch("/route").then is undefined error

@pi0
Copy link
Member Author

pi0 commented Aug 1, 2025

Wrappers can easily use Promise.resolve() when overriding globalThis.fetch to match.

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.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载