@anhdhbn/9router 0.5.116 → 0.5.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -47
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +15 -15
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +6 -6
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +12 -12
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/commandcode/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/web-login/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +4 -4
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +3 -3
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page.js +1 -1
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login/page.js +1 -1
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +15 -15
- package/app/.next-cli-build/server/chunks/1051.js +1 -1
- package/app/.next-cli-build/server/chunks/{9999.js → 1297.js} +2 -2
- package/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/app/.next-cli-build/server/chunks/{4597.js → 1568.js} +1 -1
- package/app/.next-cli-build/server/chunks/1757.js +1 -1
- package/app/.next-cli-build/server/chunks/24.js +1 -1
- package/app/.next-cli-build/server/chunks/2840.js +1 -0
- package/app/.next-cli-build/server/chunks/3225.js +1 -1
- package/app/.next-cli-build/server/chunks/3697.js +1 -1
- package/app/.next-cli-build/server/chunks/3885.js +1 -1
- package/app/.next-cli-build/server/chunks/3943.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +5 -5
- package/app/.next-cli-build/server/chunks/4123.js +1 -1
- package/app/.next-cli-build/server/chunks/4882.js +1 -1
- package/app/.next-cli-build/server/chunks/{3783.js → 5299.js} +4 -4
- package/app/.next-cli-build/server/chunks/5330.js +34 -34
- package/app/.next-cli-build/server/chunks/5485.js +1 -1
- package/app/.next-cli-build/server/chunks/5615.js +1 -1
- package/app/.next-cli-build/server/chunks/5932.js +1 -0
- package/app/.next-cli-build/server/chunks/6054.js +1 -1
- package/app/.next-cli-build/server/chunks/6070.js +1 -1
- package/app/.next-cli-build/server/chunks/615.js +1 -1
- package/app/.next-cli-build/server/chunks/6297.js +1 -0
- package/app/.next-cli-build/server/chunks/6513.js +1 -1
- package/app/.next-cli-build/server/chunks/6576.js +1 -0
- package/app/.next-cli-build/server/chunks/6690.js +1 -1
- package/app/.next-cli-build/server/chunks/6724.js +1 -1
- package/app/.next-cli-build/server/chunks/6763.js +1 -1
- package/app/.next-cli-build/server/chunks/7114.js +1 -1
- package/app/.next-cli-build/server/chunks/7187.js +1 -1
- package/app/.next-cli-build/server/chunks/7247.js +1 -1
- package/app/.next-cli-build/server/chunks/7373.js +1 -1
- package/app/.next-cli-build/server/chunks/7525.js +1 -1
- package/app/.next-cli-build/server/chunks/7552.js +1 -1
- package/app/.next-cli-build/server/chunks/7716.js +1 -1
- package/app/.next-cli-build/server/chunks/778.js +1 -1
- package/app/.next-cli-build/server/chunks/7843.js +51 -0
- package/app/.next-cli-build/server/chunks/8251.js +1 -1
- package/app/.next-cli-build/server/chunks/8402.js +1 -1
- package/app/.next-cli-build/server/chunks/8623.js +1 -1
- package/app/.next-cli-build/server/chunks/866.js +1 -0
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/8895.js +3 -3
- package/app/.next-cli-build/server/chunks/8896.js +1 -1
- package/app/.next-cli-build/server/chunks/8920.js +1 -1
- package/app/.next-cli-build/server/chunks/8994.js +1 -1
- package/app/.next-cli-build/server/chunks/9198.js +1 -0
- package/app/.next-cli-build/server/chunks/9609.js +1 -1
- package/app/.next-cli-build/server/chunks/9927.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +3 -3
- package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/preview-props.json +3 -3
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/1321-2fde166305caeddb.js +1 -0
- package/app/.next-cli-build/static/chunks/5497-832391bf809808e3.js +7 -0
- package/app/.next-cli-build/static/chunks/{9134-dce513bebf49f409.js → 761-32ad2b1ee5ca216d.js} +10 -10
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-a1c51b0c7ad758ad.js → page-6abc904471ca5d9e.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-407f76834b37cd6c.js → page-1f2d3a8531261f5a.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-a09d4b437dec0273.js → page-624cd614b7bc1f8c.js} +11 -11
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-f9f9e895a365e8d3.js → page-9ee6ec1d1ae265b8.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-efdb4d5aacfda8a6.js +27 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-371203e00dbb386a.js +4 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-cb6752cc71bde85f.js → page-98e943d2e0230bb1.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-9121f5a9bc6ae4d6.js +1 -0
- package/app/node_modules/undici/README.md +29 -116
- package/app/node_modules/undici/docs/docs/api/Agent.md +42 -249
- package/app/node_modules/undici/docs/docs/api/BalancedPool.md +48 -246
- package/app/node_modules/undici/docs/docs/api/CacheStorage.md +13 -171
- package/app/node_modules/undici/docs/docs/api/CacheStore.md +98 -309
- package/app/node_modules/undici/docs/docs/api/Client.md +164 -412
- package/app/node_modules/undici/docs/docs/api/ClientStats.md +14 -80
- package/app/node_modules/undici/docs/docs/api/Connector.md +35 -118
- package/app/node_modules/undici/docs/docs/api/ContentType.md +25 -65
- package/app/node_modules/undici/docs/docs/api/Cookies.md +71 -122
- package/app/node_modules/undici/docs/docs/api/Debug.md +18 -34
- package/app/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +167 -368
- package/app/node_modules/undici/docs/docs/api/Dispatcher.md +1056 -505
- package/app/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +93 -105
- package/app/node_modules/undici/docs/docs/api/Errors.md +28 -603
- package/app/node_modules/undici/docs/docs/api/EventSource.md +13 -326
- package/app/node_modules/undici/docs/docs/api/Fetch.md +30 -691
- package/app/node_modules/undici/docs/docs/api/GlobalInstallation.md +96 -78
- package/app/node_modules/undici/docs/docs/api/H2CClient.md +176 -299
- package/app/node_modules/undici/docs/docs/api/MockAgent.md +314 -333
- package/app/node_modules/undici/docs/docs/api/MockCallHistory.md +98 -272
- package/app/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +26 -189
- package/app/node_modules/undici/docs/docs/api/MockClient.md +33 -151
- package/app/node_modules/undici/docs/docs/api/MockErrors.md +5 -56
- package/app/node_modules/undici/docs/docs/api/MockPool.md +258 -321
- package/app/node_modules/undici/docs/docs/api/Pool.md +41 -235
- package/app/node_modules/undici/docs/docs/api/PoolStats.md +13 -119
- package/app/node_modules/undici/docs/docs/api/ProxyAgent.md +160 -179
- package/app/node_modules/undici/docs/docs/api/RedirectHandler.md +55 -241
- package/app/node_modules/undici/docs/docs/api/RetryAgent.md +27 -113
- package/app/node_modules/undici/docs/docs/api/RetryHandler.md +79 -161
- package/app/node_modules/undici/docs/docs/api/RoundRobinPool.md +72 -166
- package/app/node_modules/undici/docs/docs/api/SnapshotAgent.md +517 -262
- package/app/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +196 -177
- package/app/node_modules/undici/docs/docs/api/Util.md +11 -68
- package/app/node_modules/undici/docs/docs/api/WebSocket.md +80 -475
- package/app/node_modules/undici/docs/docs/api/api-lifecycle.md +32 -100
- package/app/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -2
- package/app/node_modules/undici/docs/docs/best-practices/crawling.md +1 -3
- package/app/node_modules/undici/docs/docs/best-practices/mocking-request.md +7 -9
- package/app/node_modules/undici/docs/docs/best-practices/proxy.md +1 -3
- package/app/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +8 -10
- package/app/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -2
- package/app/node_modules/undici/index.js +2 -4
- package/app/node_modules/undici/lib/api/api-connect.js +11 -13
- package/app/node_modules/undici/lib/api/api-pipeline.js +13 -26
- package/app/node_modules/undici/lib/api/api-request.js +21 -51
- package/app/node_modules/undici/lib/api/api-stream.js +20 -81
- package/app/node_modules/undici/lib/api/api-upgrade.js +11 -21
- package/app/node_modules/undici/lib/api/readable.js +11 -46
- package/app/node_modules/undici/lib/cache/memory-cache-store.js +15 -50
- package/app/node_modules/undici/lib/cache/sqlite-cache-store.js +18 -142
- package/app/node_modules/undici/lib/core/connect.js +7 -46
- package/app/node_modules/undici/lib/core/constants.js +23 -11
- package/app/node_modules/undici/lib/core/errors.js +3 -60
- package/app/node_modules/undici/lib/core/request.js +19 -116
- package/app/node_modules/undici/lib/core/symbols.js +0 -5
- package/app/node_modules/undici/lib/core/util.js +88 -110
- package/app/node_modules/undici/lib/dispatcher/agent.js +32 -51
- package/app/node_modules/undici/lib/dispatcher/balanced-pool.js +27 -23
- package/app/node_modules/undici/lib/dispatcher/client-h1.js +89 -166
- package/app/node_modules/undici/lib/dispatcher/client-h2.js +373 -1306
- package/app/node_modules/undici/lib/dispatcher/client.js +34 -114
- package/app/node_modules/undici/lib/dispatcher/dispatcher-base.js +8 -10
- package/app/node_modules/undici/lib/dispatcher/dispatcher.js +5 -15
- package/app/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +13 -57
- package/app/node_modules/undici/lib/dispatcher/h2c-client.js +4 -4
- package/app/node_modules/undici/lib/dispatcher/pool-base.js +27 -160
- package/app/node_modules/undici/lib/dispatcher/pool.js +16 -127
- package/app/node_modules/undici/lib/dispatcher/proxy-agent.js +29 -128
- package/app/node_modules/undici/lib/dispatcher/retry-agent.js +0 -13
- package/app/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -47
- package/app/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +63 -153
- package/app/node_modules/undici/lib/global.js +14 -37
- package/app/node_modules/undici/lib/handler/cache-handler.js +60 -101
- package/app/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -10
- package/app/node_modules/undici/lib/handler/decorator-handler.js +5 -14
- package/app/node_modules/undici/lib/handler/deduplication-handler.js +38 -74
- package/app/node_modules/undici/lib/handler/redirect-handler.js +72 -83
- package/app/node_modules/undici/lib/handler/retry-handler.js +45 -227
- package/app/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/app/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/app/node_modules/undici/lib/interceptor/cache.js +28 -53
- package/app/node_modules/undici/lib/interceptor/decompress.js +5 -12
- package/app/node_modules/undici/lib/interceptor/deduplicate.js +4 -5
- package/app/node_modules/undici/lib/interceptor/dns.js +1 -23
- package/app/node_modules/undici/lib/interceptor/redirect.js +3 -3
- package/app/node_modules/undici/lib/interceptor/response-error.js +28 -72
- package/app/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/app/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
- package/app/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
- package/app/node_modules/undici/lib/mock/mock-agent.js +9 -32
- package/app/node_modules/undici/lib/mock/mock-call-history.js +1 -1
- package/app/node_modules/undici/lib/mock/mock-interceptor.js +7 -25
- package/app/node_modules/undici/lib/mock/mock-utils.js +48 -292
- package/app/node_modules/undici/lib/mock/snapshot-agent.js +7 -25
- package/app/node_modules/undici/lib/mock/snapshot-recorder.js +5 -41
- package/app/node_modules/undici/lib/mock/snapshot-utils.js +2 -3
- package/app/node_modules/undici/lib/util/cache.js +14 -69
- package/app/node_modules/undici/lib/util/promise.js +28 -0
- package/app/node_modules/undici/lib/util/runtime-features.js +34 -3
- package/app/node_modules/undici/lib/web/cache/cache.js +16 -23
- package/app/node_modules/undici/lib/web/cache/cachestorage.js +5 -11
- package/app/node_modules/undici/lib/web/cookies/index.js +6 -16
- package/app/node_modules/undici/lib/web/cookies/parse.js +4 -7
- package/app/node_modules/undici/lib/web/cookies/util.js +1 -1
- package/app/node_modules/undici/lib/web/eventsource/eventsource.js +23 -66
- package/app/node_modules/undici/lib/web/eventsource/util.js +1 -32
- package/app/node_modules/undici/lib/web/fetch/body.js +25 -90
- package/app/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/app/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/app/node_modules/undici/lib/web/fetch/formdata-parser.js +4 -12
- package/app/node_modules/undici/lib/web/fetch/formdata.js +26 -39
- package/app/node_modules/undici/lib/web/fetch/headers.js +33 -36
- package/app/node_modules/undici/lib/web/fetch/index.js +259 -297
- package/app/node_modules/undici/lib/web/fetch/request.js +170 -172
- package/app/node_modules/undici/lib/web/fetch/response.js +47 -44
- package/app/node_modules/undici/lib/web/fetch/util.js +9 -17
- package/app/node_modules/undici/lib/web/infra/index.js +14 -15
- package/app/node_modules/undici/lib/web/webidl/index.js +21 -7
- package/app/node_modules/undici/lib/web/websocket/connection.js +5 -16
- package/app/node_modules/undici/lib/web/websocket/events.js +26 -43
- package/app/node_modules/undici/lib/web/websocket/frame.js +7 -1
- package/app/node_modules/undici/lib/web/websocket/receiver.js +3 -13
- package/app/node_modules/undici/lib/web/websocket/stream/websocketerror.js +10 -13
- package/app/node_modules/undici/lib/web/websocket/stream/websocketstream.js +14 -29
- package/app/node_modules/undici/lib/web/websocket/websocket.js +40 -65
- package/app/node_modules/undici/package.json +13 -15
- package/app/node_modules/undici/types/agent.d.ts +2 -0
- package/app/node_modules/undici/types/api.d.ts +1 -1
- package/app/node_modules/undici/types/cache-interceptor.d.ts +0 -10
- package/app/node_modules/undici/types/client.d.ts +27 -64
- package/app/node_modules/undici/types/connector.d.ts +0 -1
- package/app/node_modules/undici/types/cookies.d.ts +1 -1
- package/app/node_modules/undici/types/diagnostics-channel.d.ts +1 -2
- package/app/node_modules/undici/types/dispatcher.d.ts +30 -8
- package/app/node_modules/undici/types/errors.d.ts +1 -26
- package/app/node_modules/undici/types/fetch.d.ts +1 -5
- package/app/node_modules/undici/types/formdata.d.ts +12 -6
- package/app/node_modules/undici/types/h2c-client.d.ts +7 -7
- package/app/node_modules/undici/types/handlers.d.ts +0 -2
- package/app/node_modules/undici/types/header.d.ts +0 -5
- package/app/node_modules/undici/types/index.d.ts +1 -3
- package/app/node_modules/undici/types/interceptors.d.ts +2 -7
- package/app/node_modules/undici/types/mock-agent.d.ts +10 -11
- package/app/node_modules/undici/types/mock-interceptor.d.ts +1 -5
- package/app/node_modules/undici/types/pool.d.ts +2 -0
- package/app/node_modules/undici/types/proxy-agent.d.ts +2 -9
- package/app/node_modules/undici/types/retry-handler.d.ts +3 -3
- package/app/node_modules/undici/types/round-robin-pool.d.ts +2 -0
- package/app/node_modules/undici/types/snapshot-agent.d.ts +0 -4
- package/app/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -4
- package/app/node_modules/undici/types/utility.d.ts +4 -4
- package/app/node_modules/undici/types/webidl.d.ts +8 -13
- package/app/package.json +5 -2
- package/app/public/providers/sensenova-intl.png +0 -0
- package/app/src/shared/services/quotaAutoPing.js +17 -2
- package/package.json +2 -2
- package/app/.next-cli-build/server/chunks/1004.js +0 -1
- package/app/.next-cli-build/server/chunks/4480.js +0 -1
- package/app/.next-cli-build/server/chunks/4811.js +0 -51
- package/app/.next-cli-build/server/chunks/547.js +0 -1
- package/app/.next-cli-build/server/chunks/7573.js +0 -1
- package/app/.next-cli-build/server/chunks/8499.js +0 -1
- package/app/.next-cli-build/server/chunks/9102.js +0 -1
- package/app/.next-cli-build/static/chunks/1321-93eb6ca56f8fcb1e.js +0 -1
- package/app/.next-cli-build/static/chunks/5497-02b05d77d17bcdc3.js +0 -7
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-74ca3f1d4f1ec046.js +0 -27
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b44167799c6c673a.js +0 -4
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-f16fd9091b7ae81c.js +0 -1
- package/app/node_modules/undici/docs/docs/api/Interceptors.md +0 -439
- package/app/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +0 -233
- package/app/node_modules/undici/docs/docs/getting-started.md +0 -281
- package/app/node_modules/undici/docs/docs/index.md +0 -793
- package/app/node_modules/undici/docs/docs/site.json +0 -125
- package/app/node_modules/undici/docs/docs/type-map.json +0 -79
- package/app/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -127
- package/app/node_modules/undici/lib/dispatcher/parser-h1.js +0 -1065
- package/app/node_modules/undici/lib/milo/LICENSE.md +0 -7
- package/app/node_modules/undici/lib/milo/no-simd.js +0 -1002
- package/app/node_modules/undici/lib/milo/simd.js +0 -1002
- package/app/node_modules/undici/types/dispatcher1-wrapper.d.ts +0 -7
- /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_ssgManifest.js +0 -0
|
@@ -1,61 +1,34 @@
|
|
|
1
1
|
# Dispatcher
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Extends: `events.EventEmitter`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Dispatcher is the core API used to dispatch requests.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Requests are not guaranteed to be dispatched in order of invocation.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Instance Methods
|
|
10
10
|
|
|
11
|
-
`Dispatcher`
|
|
12
|
-
It extends [`EventEmitter`][] and defines the low-level [`dispatch()`][] contract
|
|
13
|
-
along with the higher-level [`request()`][], [`stream()`][], [`pipeline()`][],
|
|
14
|
-
[`connect()`][], and [`upgrade()`][] methods that every concrete dispatcher
|
|
15
|
-
provides.
|
|
11
|
+
### `Dispatcher.close([callback]): Promise`
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
[`destroy()`][] methods throw `Error: not implemented`. Concrete dispatchers such
|
|
19
|
-
as [`Client`][], [`Pool`][], [`BalancedPool`][], and [`Agent`][] implement the
|
|
20
|
-
contract and are what application code instantiates. Requests are not guaranteed
|
|
21
|
-
to be dispatched in the order in which they are invoked.
|
|
13
|
+
Closes the dispatcher and gracefully waits for enqueued requests to complete before resolving.
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
import { Dispatcher, Agent } from 'undici'
|
|
15
|
+
Arguments:
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
console.log(dispatcher instanceof Dispatcher) // true
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Class: `Dispatcher`
|
|
31
|
-
|
|
32
|
-
<!-- YAML
|
|
33
|
-
added: v4.0.0
|
|
34
|
-
-->
|
|
35
|
-
|
|
36
|
-
* Extends: {EventEmitter}
|
|
37
|
-
|
|
38
|
-
Base dispatcher class. Concrete dispatchers extend it and implement the
|
|
39
|
-
[`dispatch()`][] method on which the other request helpers are built.
|
|
40
|
-
|
|
41
|
-
### `dispatcher.close([callback])`
|
|
17
|
+
* **callback** `(error: Error | null, data: null) => void` (optional)
|
|
42
18
|
|
|
43
|
-
|
|
44
|
-
added: v4.0.0
|
|
45
|
-
-->
|
|
19
|
+
Returns: `void | Promise<null>` - Only returns a `Promise` if no `callback` argument was passed
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
21
|
+
```js
|
|
22
|
+
dispatcher.close() // -> Promise
|
|
23
|
+
dispatcher.close(() => {}) // -> void
|
|
24
|
+
```
|
|
51
25
|
|
|
52
|
-
|
|
53
|
-
before resolving or invoking `callback`.
|
|
26
|
+
#### Example - Request resolves before Client closes
|
|
54
27
|
|
|
55
|
-
```
|
|
56
|
-
import { createServer } from '
|
|
28
|
+
```js
|
|
29
|
+
import { createServer } from 'http'
|
|
57
30
|
import { Client } from 'undici'
|
|
58
|
-
import { once } from '
|
|
31
|
+
import { once } from 'events'
|
|
59
32
|
|
|
60
33
|
const server = createServer((request, response) => {
|
|
61
34
|
response.end('undici')
|
|
@@ -66,7 +39,10 @@ await once(server, 'listening')
|
|
|
66
39
|
const client = new Client(`http://localhost:${server.address().port}`)
|
|
67
40
|
|
|
68
41
|
try {
|
|
69
|
-
const { body } = await client.request({
|
|
42
|
+
const { body } = await client.request({
|
|
43
|
+
path: '/',
|
|
44
|
+
method: 'GET'
|
|
45
|
+
})
|
|
70
46
|
body.setEncoding('utf8')
|
|
71
47
|
body.on('data', console.log)
|
|
72
48
|
} catch (error) {}
|
|
@@ -77,41 +53,40 @@ console.log('Client closed')
|
|
|
77
53
|
server.close()
|
|
78
54
|
```
|
|
79
55
|
|
|
80
|
-
### `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
* `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
import { createServer } from 'node:http'
|
|
56
|
+
### `Dispatcher.connect(options[, callback])`
|
|
57
|
+
|
|
58
|
+
Starts two-way communications with the requested resource using [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT).
|
|
59
|
+
|
|
60
|
+
Arguments:
|
|
61
|
+
|
|
62
|
+
* **options** `ConnectOptions`
|
|
63
|
+
* **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
|
|
64
|
+
|
|
65
|
+
Returns: `void | Promise<ConnectData>` - Only returns a `Promise` if no `callback` argument was passed
|
|
66
|
+
|
|
67
|
+
#### Parameter: `ConnectOptions`
|
|
68
|
+
|
|
69
|
+
* **path** `string`
|
|
70
|
+
* **headers** `UndiciHeaders` (optional) - Default: `null`
|
|
71
|
+
* **signal** `AbortSignal | events.EventEmitter | null` (optional) - Default: `null`
|
|
72
|
+
* **opaque** `unknown` (optional) - This argument parameter is passed through to `ConnectData`
|
|
73
|
+
|
|
74
|
+
#### Parameter: `ConnectData`
|
|
75
|
+
|
|
76
|
+
* **statusCode** `number`
|
|
77
|
+
* **headers** `Record<string, string | string[] | undefined>`
|
|
78
|
+
* **socket** `stream.Duplex`
|
|
79
|
+
* **opaque** `unknown`
|
|
80
|
+
|
|
81
|
+
#### Example - Connect request with echo
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import { createServer } from 'http'
|
|
110
85
|
import { Client } from 'undici'
|
|
111
|
-
import { once } from '
|
|
86
|
+
import { once } from 'events'
|
|
112
87
|
|
|
113
88
|
const server = createServer((request, response) => {
|
|
114
|
-
throw
|
|
89
|
+
throw Error('should never get here')
|
|
115
90
|
}).listen()
|
|
116
91
|
|
|
117
92
|
server.on('connect', (req, socket, head) => {
|
|
@@ -132,7 +107,9 @@ await once(server, 'listening')
|
|
|
132
107
|
const client = new Client(`http://localhost:${server.address().port}`)
|
|
133
108
|
|
|
134
109
|
try {
|
|
135
|
-
const { socket } = await client.connect({
|
|
110
|
+
const { socket } = await client.connect({
|
|
111
|
+
path: '/'
|
|
112
|
+
})
|
|
136
113
|
const wanted = 'Body'
|
|
137
114
|
let data = ''
|
|
138
115
|
socket.on('data', d => { data += d })
|
|
@@ -143,39 +120,35 @@ try {
|
|
|
143
120
|
})
|
|
144
121
|
socket.write(wanted)
|
|
145
122
|
socket.end()
|
|
146
|
-
} catch (error) {}
|
|
123
|
+
} catch (error) { }
|
|
147
124
|
```
|
|
148
125
|
|
|
149
|
-
### `
|
|
126
|
+
### `Dispatcher.destroy([error, callback]): Promise`
|
|
127
|
+
|
|
128
|
+
Destroy the dispatcher abruptly with the given error. All the pending and running requests will be asynchronously aborted and error. Since this operation is asynchronously dispatched there might still be some progress on dispatched requests.
|
|
150
129
|
|
|
151
|
-
|
|
152
|
-
added: v4.0.0
|
|
153
|
-
-->
|
|
130
|
+
Both arguments are optional; the method can be called in four different ways:
|
|
154
131
|
|
|
155
|
-
|
|
156
|
-
rejected. **Default:** `null`.
|
|
157
|
-
* `callback` {Function} (optional) Invoked once the socket is closed.
|
|
158
|
-
* Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
|
|
159
|
-
resolves with `void` once the dispatcher is destroyed.
|
|
132
|
+
Arguments:
|
|
160
133
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
dispatched asynchronously, dispatched requests may still make some progress
|
|
164
|
-
before being aborted.
|
|
134
|
+
* **error** `Error | null` (optional)
|
|
135
|
+
* **callback** `(error: Error | null, data: null) => void` (optional)
|
|
165
136
|
|
|
166
|
-
|
|
137
|
+
Returns: `void | Promise<void>` - Only returns a `Promise` if no `callback` argument was passed
|
|
167
138
|
|
|
168
|
-
```
|
|
139
|
+
```js
|
|
169
140
|
dispatcher.destroy() // -> Promise
|
|
170
141
|
dispatcher.destroy(new Error()) // -> Promise
|
|
171
142
|
dispatcher.destroy(() => {}) // -> void
|
|
172
143
|
dispatcher.destroy(new Error(), () => {}) // -> void
|
|
173
144
|
```
|
|
174
145
|
|
|
175
|
-
|
|
176
|
-
|
|
146
|
+
#### Example - Request is aborted when Client is destroyed
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
import { createServer } from 'http'
|
|
177
150
|
import { Client } from 'undici'
|
|
178
|
-
import { once } from '
|
|
151
|
+
import { once } from 'events'
|
|
179
152
|
|
|
180
153
|
const server = createServer((request, response) => {
|
|
181
154
|
response.end()
|
|
@@ -186,7 +159,10 @@ await once(server, 'listening')
|
|
|
186
159
|
const client = new Client(`http://localhost:${server.address().port}`)
|
|
187
160
|
|
|
188
161
|
try {
|
|
189
|
-
const request = client.request({
|
|
162
|
+
const request = client.request({
|
|
163
|
+
path: '/',
|
|
164
|
+
method: 'GET'
|
|
165
|
+
})
|
|
190
166
|
client.destroy()
|
|
191
167
|
.then(() => {
|
|
192
168
|
console.log('Client destroyed')
|
|
@@ -198,117 +174,50 @@ try {
|
|
|
198
174
|
}
|
|
199
175
|
```
|
|
200
176
|
|
|
201
|
-
### `
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
* `expectContinue` {boolean} For HTTP/2, appends the `expect: 100-continue`
|
|
244
|
-
header and halts the request body until a `100 Continue` is received from the
|
|
245
|
-
remote server. **Default:** `false`.
|
|
246
|
-
* `handler` {Object} A set of callbacks invoked over the request lifecycle.
|
|
247
|
-
* `onRequestStart` {Function} Invoked before the request is dispatched on the
|
|
248
|
-
socket. May be invoked multiple times when the request is retried.
|
|
249
|
-
* `controller` {DispatchController}
|
|
250
|
-
* `context` {any}
|
|
251
|
-
* `onRequestUpgrade` {Function} (optional) Invoked when the request is upgraded.
|
|
252
|
-
Required when `options.upgrade` is set or `options.method` is `'CONNECT'`.
|
|
253
|
-
* `controller` {DispatchController}
|
|
254
|
-
* `statusCode` {number}
|
|
255
|
-
* `headers` {Object}
|
|
256
|
-
* `socket` {Duplex}
|
|
257
|
-
* `onResponseStart` {Function} (optional) Invoked when the status code and
|
|
258
|
-
headers have been received. May be invoked multiple times for 1xx
|
|
259
|
-
informational responses. Not used for `upgrade` requests.
|
|
260
|
-
* `controller` {DispatchController}
|
|
261
|
-
* `statusCode` {number}
|
|
262
|
-
* `headers` {Object}
|
|
263
|
-
* `statusMessage` {string} (optional)
|
|
264
|
-
* `onResponseData` {Function} (optional) Invoked when response payload data is
|
|
265
|
-
received. Not used for `upgrade` requests.
|
|
266
|
-
* `controller` {DispatchController}
|
|
267
|
-
* `chunk` {Buffer}
|
|
268
|
-
* `onResponseEnd` {Function} (optional) Invoked when the response payload and
|
|
269
|
-
trailers have been received and the request has completed. Not used for
|
|
270
|
-
`upgrade` requests.
|
|
271
|
-
* `controller` {DispatchController}
|
|
272
|
-
* `trailers` {Object}
|
|
273
|
-
* `onResponseError` {Function} (optional) Invoked when an error occurs. Must not
|
|
274
|
-
throw.
|
|
275
|
-
* `controller` {DispatchController}
|
|
276
|
-
* `error` {Error}
|
|
277
|
-
* `onResponseStarted` {Function} (optional) Invoked when the response is
|
|
278
|
-
received, before headers have been read.
|
|
279
|
-
* `onBodySent` {Function} (optional) Invoked when a chunk of the request body is
|
|
280
|
-
sent. May be invoked multiple times for chunked requests.
|
|
281
|
-
* `chunk` {Buffer}
|
|
282
|
-
* `onRequestSent` {Function} (optional) Invoked after the request body is fully
|
|
283
|
-
sent.
|
|
284
|
-
* Returns: {boolean} `false` when the dispatcher is busy and further `dispatch()`
|
|
285
|
-
calls will make no progress until the [`'drain'`][] event is emitted.
|
|
286
|
-
|
|
287
|
-
This is the low-level API on which all the higher-level methods are built. This
|
|
288
|
-
API is expected to evolve through semver-major versions and is less stable than
|
|
289
|
-
the higher-level methods. It is primarily intended for library developers who
|
|
290
|
-
implement higher-level APIs on top of it.
|
|
291
|
-
|
|
292
|
-
The `controller` passed to each handler is a `DispatchController` with the
|
|
293
|
-
following shape:
|
|
294
|
-
|
|
295
|
-
* `aborted` {boolean} Whether the request has been aborted.
|
|
296
|
-
* `paused` {boolean} Whether the request is paused.
|
|
297
|
-
* `reason` {Error|null} The reason the request was aborted, if any.
|
|
298
|
-
* `rawHeaders` {Buffer[]|string[]|Object|null} The raw response headers,
|
|
299
|
-
preserving duplicates and casing.
|
|
300
|
-
* `rawTrailers` {Buffer[]|string[]|Object|null} The raw response trailers.
|
|
301
|
-
* `abort(reason)` Aborts the request with the given `reason`.
|
|
302
|
-
* `pause()` Pauses the response stream.
|
|
303
|
-
* `resume()` Resumes the response stream.
|
|
304
|
-
|
|
305
|
-
Call `controller.pause()` and `controller.resume()` to apply backpressure rather
|
|
306
|
-
than returning `false` from a handler.
|
|
307
|
-
|
|
308
|
-
```mjs
|
|
309
|
-
import { createServer } from 'node:http'
|
|
177
|
+
### `Dispatcher.dispatch(options, handler)`
|
|
178
|
+
|
|
179
|
+
This is the low level API which all the preceding APIs are implemented on top of.
|
|
180
|
+
This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs.
|
|
181
|
+
It is primarily intended for library developers who implement higher level APIs on top of this.
|
|
182
|
+
|
|
183
|
+
Arguments:
|
|
184
|
+
|
|
185
|
+
* **options** `DispatchOptions`
|
|
186
|
+
* **handler** `DispatchHandler`
|
|
187
|
+
|
|
188
|
+
Returns: `Boolean` - `false` if dispatcher is busy and further dispatch calls won't make any progress until the `'drain'` event has been emitted.
|
|
189
|
+
|
|
190
|
+
#### Parameter: `DispatchOptions`
|
|
191
|
+
|
|
192
|
+
* **origin** `string | URL`
|
|
193
|
+
* **path** `string`
|
|
194
|
+
* **method** `string`
|
|
195
|
+
* **reset** `boolean` (optional) - Default: `false` - If `false`, the request will attempt to create a long-living connection by sending the `connection: keep-alive` header,otherwise will attempt to close it immediately after response by sending `connection: close` within the request and closing the socket afterwards.
|
|
196
|
+
* **body** `string | Buffer | Uint8Array | stream.Readable | Iterable | AsyncIterable | null` (optional) - Default: `null`
|
|
197
|
+
* **headers** `UndiciHeaders` (optional) - Default: `null`.
|
|
198
|
+
* **query** `Record<string, any> | null` (optional) - Default: `null` - Query string params to be embedded in the request URL. Note that both keys and values of query are encoded using `encodeURIComponent`. If for some reason you need to send them unencoded, embed query params into path directly instead.
|
|
199
|
+
* **idempotent** `boolean` (optional) - Default: `true` if `method` is `'HEAD'` or `'GET'` - Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline has completed.
|
|
200
|
+
* **blocking** `boolean` (optional) - Default: `method !== 'HEAD'` - Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received.
|
|
201
|
+
* **upgrade** `string | null` (optional) - Default: `null` - Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`.
|
|
202
|
+
* **bodyTimeout** `number | null` (optional) - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds.
|
|
203
|
+
* **headersTimeout** `number | null` (optional) - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
|
|
204
|
+
* **expectContinue** `boolean` (optional) - Default: `false` - For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server
|
|
205
|
+
|
|
206
|
+
#### Parameter: `DispatchHandler`
|
|
207
|
+
|
|
208
|
+
* **onRequestStart** `(controller: DispatchController, context: object) => void` - Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails.
|
|
209
|
+
* **onRequestUpgrade** `(controller: DispatchController, statusCode: number, headers: Record<string, string | string[]>, socket: Duplex) => void` (optional) - Invoked when request is upgraded. Required if `DispatchOptions.upgrade` is defined or `DispatchOptions.method === 'CONNECT'`.
|
|
210
|
+
* **onResponseStart** `(controller: DispatchController, statusCode: number, headers: Record<string, string | string []>, statusMessage?: string) => void` - Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. Not required for `upgrade` requests. Any return value is ignored.
|
|
211
|
+
* **onResponseData** `(controller: DispatchController, chunk: Buffer) => void` - Invoked when response payload data is received. Not required for `upgrade` requests.
|
|
212
|
+
* **onResponseEnd** `(controller: DispatchController, trailers: Record<string, string | string[]>) => void` - Invoked when response payload and trailers have been received and the request has completed. Not required for `upgrade` requests.
|
|
213
|
+
* **onResponseError** `(controller: DispatchController, error: Error) => void` - Invoked when an error has occurred. May not throw.
|
|
214
|
+
|
|
215
|
+
#### Example 1 - Dispatch GET request
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
import { createServer } from 'http'
|
|
310
219
|
import { Client } from 'undici'
|
|
311
|
-
import { once } from '
|
|
220
|
+
import { once } from 'events'
|
|
312
221
|
|
|
313
222
|
const server = createServer((request, response) => {
|
|
314
223
|
response.end('Hello, World!')
|
|
@@ -323,61 +232,169 @@ const data = []
|
|
|
323
232
|
client.dispatch({
|
|
324
233
|
path: '/',
|
|
325
234
|
method: 'GET',
|
|
326
|
-
headers: {
|
|
235
|
+
headers: {
|
|
236
|
+
'x-foo': 'bar'
|
|
237
|
+
}
|
|
327
238
|
}, {
|
|
328
|
-
|
|
239
|
+
onConnect: () => {
|
|
329
240
|
console.log('Connected!')
|
|
330
241
|
},
|
|
331
|
-
|
|
242
|
+
onError: (error) => {
|
|
332
243
|
console.error(error)
|
|
333
244
|
},
|
|
334
|
-
|
|
335
|
-
console.log(`statusCode: ${statusCode} | headers: ${
|
|
245
|
+
onHeaders: (statusCode, headers) => {
|
|
246
|
+
console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`)
|
|
336
247
|
},
|
|
337
|
-
|
|
248
|
+
onData: (chunk) => {
|
|
249
|
+
console.log('onData: chunk received')
|
|
338
250
|
data.push(chunk)
|
|
339
251
|
},
|
|
340
|
-
|
|
341
|
-
console.log(`trailers: ${
|
|
342
|
-
|
|
252
|
+
onComplete: (trailers) => {
|
|
253
|
+
console.log(`onComplete | trailers: ${trailers}`)
|
|
254
|
+
const res = Buffer.concat(data).toString('utf8')
|
|
255
|
+
console.log(`Data: ${res}`)
|
|
343
256
|
client.close()
|
|
344
257
|
server.close()
|
|
345
258
|
}
|
|
346
259
|
})
|
|
347
260
|
```
|
|
348
261
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
-->
|
|
354
|
-
|
|
355
|
-
* `options` {Object} Accepts every field of [`dispatcher.request()`][]'s
|
|
356
|
-
`options`, plus:
|
|
357
|
-
* `objectMode` {boolean} Set to `true` when `handler` returns an object stream.
|
|
358
|
-
**Default:** `false`.
|
|
359
|
-
* `handler` {Function} Returns a `Readable` from which the result is read.
|
|
360
|
-
* `data` {Object}
|
|
361
|
-
* `statusCode` {number}
|
|
362
|
-
* `headers` {Object} The response headers.
|
|
363
|
-
* `opaque` {any} The `opaque` value passed in `options`.
|
|
364
|
-
* `body` {Readable} The response body.
|
|
365
|
-
* `context` {Object}
|
|
366
|
-
* Returns: {Readable}
|
|
367
|
-
* Returns: {Duplex} A duplex stream that writes to the request and reads from the
|
|
368
|
-
response.
|
|
369
|
-
|
|
370
|
-
For easy use with [`stream.pipeline()`][]. The `handler` should return a
|
|
371
|
-
`Readable` from which the result is read. Usually it returns the `body` directly,
|
|
372
|
-
unless a transformation is needed based on, for example, `headers` or
|
|
373
|
-
`statusCode`. The `handler` should validate the response and save any required
|
|
374
|
-
state; if there is an error, it should be thrown.
|
|
375
|
-
|
|
376
|
-
```mjs
|
|
377
|
-
import { Readable, Writable, PassThrough, pipeline } from 'node:stream'
|
|
378
|
-
import { createServer } from 'node:http'
|
|
262
|
+
#### Example 2 - Dispatch Upgrade Request
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
import { createServer } from 'http'
|
|
379
266
|
import { Client } from 'undici'
|
|
380
|
-
import { once } from '
|
|
267
|
+
import { once } from 'events'
|
|
268
|
+
|
|
269
|
+
const server = createServer((request, response) => {
|
|
270
|
+
response.end()
|
|
271
|
+
}).listen()
|
|
272
|
+
|
|
273
|
+
await once(server, 'listening')
|
|
274
|
+
|
|
275
|
+
server.on('upgrade', (request, socket, head) => {
|
|
276
|
+
console.log('Node.js Server - upgrade event')
|
|
277
|
+
socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n')
|
|
278
|
+
socket.write('Upgrade: WebSocket\r\n')
|
|
279
|
+
socket.write('Connection: Upgrade\r\n')
|
|
280
|
+
socket.write('\r\n')
|
|
281
|
+
socket.end()
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
285
|
+
|
|
286
|
+
client.dispatch({
|
|
287
|
+
path: '/',
|
|
288
|
+
method: 'GET',
|
|
289
|
+
upgrade: 'websocket'
|
|
290
|
+
}, {
|
|
291
|
+
onConnect: () => {
|
|
292
|
+
console.log('Undici Client - onConnect')
|
|
293
|
+
},
|
|
294
|
+
onError: (error) => {
|
|
295
|
+
console.log('onError') // shouldn't print
|
|
296
|
+
},
|
|
297
|
+
onUpgrade: (statusCode, headers, socket) => {
|
|
298
|
+
console.log('Undici Client - onUpgrade')
|
|
299
|
+
console.log(`onUpgrade Headers: ${headers}`)
|
|
300
|
+
socket.on('data', buffer => {
|
|
301
|
+
console.log(buffer.toString('utf8'))
|
|
302
|
+
})
|
|
303
|
+
socket.on('end', () => {
|
|
304
|
+
client.close()
|
|
305
|
+
server.close()
|
|
306
|
+
})
|
|
307
|
+
socket.end()
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### Example 3 - Dispatch POST request
|
|
313
|
+
|
|
314
|
+
```js
|
|
315
|
+
import { createServer } from 'http'
|
|
316
|
+
import { Client } from 'undici'
|
|
317
|
+
import { once } from 'events'
|
|
318
|
+
|
|
319
|
+
const server = createServer((request, response) => {
|
|
320
|
+
request.on('data', (data) => {
|
|
321
|
+
console.log(`Request Data: ${data.toString('utf8')}`)
|
|
322
|
+
const body = JSON.parse(data)
|
|
323
|
+
body.message = 'World'
|
|
324
|
+
response.end(JSON.stringify(body))
|
|
325
|
+
})
|
|
326
|
+
}).listen()
|
|
327
|
+
|
|
328
|
+
await once(server, 'listening')
|
|
329
|
+
|
|
330
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
331
|
+
|
|
332
|
+
const data = []
|
|
333
|
+
|
|
334
|
+
client.dispatch({
|
|
335
|
+
path: '/',
|
|
336
|
+
method: 'POST',
|
|
337
|
+
headers: {
|
|
338
|
+
'content-type': 'application/json'
|
|
339
|
+
},
|
|
340
|
+
body: JSON.stringify({ message: 'Hello' })
|
|
341
|
+
}, {
|
|
342
|
+
onConnect: () => {
|
|
343
|
+
console.log('Connected!')
|
|
344
|
+
},
|
|
345
|
+
onError: (error) => {
|
|
346
|
+
console.error(error)
|
|
347
|
+
},
|
|
348
|
+
onHeaders: (statusCode, headers) => {
|
|
349
|
+
console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`)
|
|
350
|
+
},
|
|
351
|
+
onData: (chunk) => {
|
|
352
|
+
console.log('onData: chunk received')
|
|
353
|
+
data.push(chunk)
|
|
354
|
+
},
|
|
355
|
+
onComplete: (trailers) => {
|
|
356
|
+
console.log(`onComplete | trailers: ${trailers}`)
|
|
357
|
+
const res = Buffer.concat(data).toString('utf8')
|
|
358
|
+
console.log(`Response Data: ${res}`)
|
|
359
|
+
client.close()
|
|
360
|
+
server.close()
|
|
361
|
+
}
|
|
362
|
+
})
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### `Dispatcher.pipeline(options, handler)`
|
|
366
|
+
|
|
367
|
+
For easy use with [stream.pipeline](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options). The `handler` argument should return a `Readable` from which the result will be read. Usually it should just return the `body` argument unless some kind of transformation needs to be performed based on e.g. `headers` or `statusCode`. The `handler` should validate the response and save any required state. If there is an error, it should be thrown. The function returns a `Duplex` which writes to the request and reads from the response.
|
|
368
|
+
|
|
369
|
+
Arguments:
|
|
370
|
+
|
|
371
|
+
* **options** `PipelineOptions`
|
|
372
|
+
* **handler** `(data: PipelineHandlerData) => stream.Readable`
|
|
373
|
+
|
|
374
|
+
Returns: `stream.Duplex`
|
|
375
|
+
|
|
376
|
+
#### Parameter: PipelineOptions
|
|
377
|
+
|
|
378
|
+
Extends: [`RequestOptions`](/docs/docs/api/Dispatcher.md#parameter-requestoptions)
|
|
379
|
+
|
|
380
|
+
* **objectMode** `boolean` (optional) - Default: `false` - Set to `true` if the `handler` will return an object stream.
|
|
381
|
+
|
|
382
|
+
#### Parameter: PipelineHandlerData
|
|
383
|
+
|
|
384
|
+
* **statusCode** `number`
|
|
385
|
+
* **headers** `Record<string, string | string[] | undefined>`
|
|
386
|
+
* **opaque** `unknown`
|
|
387
|
+
* **body** `stream.Readable`
|
|
388
|
+
* **context** `object`
|
|
389
|
+
* **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
|
|
390
|
+
|
|
391
|
+
#### Example 1 - Pipeline Echo
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
import { Readable, Writable, PassThrough, pipeline } from 'stream'
|
|
395
|
+
import { createServer } from 'http'
|
|
396
|
+
import { Client } from 'undici'
|
|
397
|
+
import { once } from 'events'
|
|
381
398
|
|
|
382
399
|
const server = createServer((request, response) => {
|
|
383
400
|
request.pipe(response)
|
|
@@ -396,7 +413,10 @@ pipeline(
|
|
|
396
413
|
this.push(null)
|
|
397
414
|
}
|
|
398
415
|
}),
|
|
399
|
-
client.pipeline({
|
|
416
|
+
client.pipeline({
|
|
417
|
+
path: '/',
|
|
418
|
+
method: 'GET'
|
|
419
|
+
}, ({ statusCode, headers, body }) => {
|
|
400
420
|
console.log(`response received ${statusCode}`)
|
|
401
421
|
console.log('headers', headers)
|
|
402
422
|
return pipeline(body, new PassThrough(), () => {})
|
|
@@ -415,81 +435,79 @@ pipeline(
|
|
|
415
435
|
if (error) {
|
|
416
436
|
console.error(error)
|
|
417
437
|
}
|
|
438
|
+
|
|
418
439
|
client.close()
|
|
419
440
|
server.close()
|
|
420
441
|
}
|
|
421
442
|
)
|
|
422
443
|
```
|
|
423
444
|
|
|
424
|
-
### `
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
*
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
[`.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
`
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
```mjs
|
|
490
|
-
import { createServer } from 'node:http'
|
|
445
|
+
### `Dispatcher.request(options[, callback])`
|
|
446
|
+
|
|
447
|
+
Performs a HTTP request.
|
|
448
|
+
|
|
449
|
+
Non-idempotent requests will not be pipelined in order
|
|
450
|
+
to avoid indirect failures.
|
|
451
|
+
|
|
452
|
+
Idempotent requests will be automatically retried if
|
|
453
|
+
they fail due to indirect failure from the request
|
|
454
|
+
at the head of the pipeline. This does not apply to
|
|
455
|
+
idempotent requests with a stream request body.
|
|
456
|
+
|
|
457
|
+
All response bodies must always be fully consumed or destroyed.
|
|
458
|
+
|
|
459
|
+
Arguments:
|
|
460
|
+
|
|
461
|
+
* **options** `RequestOptions`
|
|
462
|
+
* **callback** `(error: Error | null, data: ResponseData) => void` (optional)
|
|
463
|
+
|
|
464
|
+
Returns: `void | Promise<ResponseData>` - Only returns a `Promise` if no `callback` argument was passed.
|
|
465
|
+
|
|
466
|
+
#### Parameter: `RequestOptions`
|
|
467
|
+
|
|
468
|
+
Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions)
|
|
469
|
+
|
|
470
|
+
* **opaque** `unknown` (optional) - Default: `null` - Used for passing through context to `ResponseData`.
|
|
471
|
+
* **signal** `AbortSignal | events.EventEmitter | null` (optional) - Default: `null`.
|
|
472
|
+
* **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
|
|
473
|
+
|
|
474
|
+
The `RequestOptions.method` property should not be value `'CONNECT'`.
|
|
475
|
+
|
|
476
|
+
#### Parameter: `ResponseData`
|
|
477
|
+
|
|
478
|
+
* **statusCode** `number`
|
|
479
|
+
* **statusText** `string` - The status message from the response (e.g., "OK", "Not Found").
|
|
480
|
+
* **headers** `Record<string, string | string[]>` - Note that all header keys are lower-cased, e.g. `content-type`.
|
|
481
|
+
* **body** `stream.Readable` which also implements [the body mixin from the Fetch Standard](https://fetch.spec.whatwg.org/#body-mixin).
|
|
482
|
+
* **trailers** `Record<string, string>` - This object starts out
|
|
483
|
+
as empty and will be mutated to contain trailers after `body` has emitted `'end'`.
|
|
484
|
+
* **opaque** `unknown`
|
|
485
|
+
* **context** `object`
|
|
486
|
+
|
|
487
|
+
`body` contains the following additional [body mixin](https://fetch.spec.whatwg.org/#body-mixin) methods and properties:
|
|
488
|
+
|
|
489
|
+
* [`.arrayBuffer()`](https://fetch.spec.whatwg.org/#dom-body-arraybuffer)
|
|
490
|
+
* [`.blob()`](https://fetch.spec.whatwg.org/#dom-body-blob)
|
|
491
|
+
* [`.bytes()`](https://fetch.spec.whatwg.org/#dom-body-bytes)
|
|
492
|
+
* [`.json()`](https://fetch.spec.whatwg.org/#dom-body-json)
|
|
493
|
+
* [`.text()`](https://fetch.spec.whatwg.org/#dom-body-text)
|
|
494
|
+
* `body`
|
|
495
|
+
* `bodyUsed`
|
|
496
|
+
|
|
497
|
+
`body` can not be consumed twice. For example, calling `text()` after `json()` throws `TypeError`.
|
|
498
|
+
|
|
499
|
+
`body` contains the following additional extensions:
|
|
500
|
+
|
|
501
|
+
- `dump({ limit: Integer })`, dump the response by reading up to `limit` bytes without killing the socket (optional) - Default: 262144.
|
|
502
|
+
|
|
503
|
+
Note that body will still be a `Readable` even if it is empty, but attempting to deserialize it with `json()` will result in an exception. Recommended way to ensure there is a body to deserialize is to check if status code is not 204, and `content-type` header starts with `application/json`.
|
|
504
|
+
|
|
505
|
+
#### Example 1 - Basic GET Request
|
|
506
|
+
|
|
507
|
+
```js
|
|
508
|
+
import { createServer } from 'http'
|
|
491
509
|
import { Client } from 'undici'
|
|
492
|
-
import { once } from '
|
|
510
|
+
import { once } from 'events'
|
|
493
511
|
|
|
494
512
|
const server = createServer((request, response) => {
|
|
495
513
|
response.end('Hello, World!')
|
|
@@ -520,28 +538,107 @@ try {
|
|
|
520
538
|
}
|
|
521
539
|
```
|
|
522
540
|
|
|
523
|
-
|
|
524
|
-
emits an `'abort'` event, or by destroying the response body:
|
|
541
|
+
#### Example 2 - Aborting a request
|
|
525
542
|
|
|
526
|
-
|
|
543
|
+
> Node.js v15+ is required to run this example
|
|
544
|
+
|
|
545
|
+
```js
|
|
546
|
+
import { createServer } from 'http'
|
|
527
547
|
import { Client } from 'undici'
|
|
548
|
+
import { once } from 'events'
|
|
528
549
|
|
|
529
|
-
const
|
|
550
|
+
const server = createServer((request, response) => {
|
|
551
|
+
response.end('Hello, World!')
|
|
552
|
+
}).listen()
|
|
553
|
+
|
|
554
|
+
await once(server, 'listening')
|
|
555
|
+
|
|
556
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
530
557
|
const abortController = new AbortController()
|
|
531
558
|
|
|
532
559
|
try {
|
|
533
|
-
client.request({
|
|
560
|
+
client.request({
|
|
561
|
+
path: '/',
|
|
562
|
+
method: 'GET',
|
|
563
|
+
signal: abortController.signal
|
|
564
|
+
})
|
|
534
565
|
} catch (error) {
|
|
535
|
-
console.error(error) // RequestAbortedError
|
|
566
|
+
console.error(error) // should print an RequestAbortedError
|
|
567
|
+
client.close()
|
|
568
|
+
server.close()
|
|
536
569
|
}
|
|
537
570
|
|
|
538
571
|
abortController.abort()
|
|
539
572
|
```
|
|
540
573
|
|
|
541
|
-
|
|
574
|
+
Alternatively, any `EventEmitter` that emits an `'abort'` event may be used as an abort controller:
|
|
542
575
|
|
|
543
|
-
```
|
|
544
|
-
|
|
576
|
+
```js
|
|
577
|
+
import { createServer } from 'http'
|
|
578
|
+
import { Client } from 'undici'
|
|
579
|
+
import EventEmitter, { once } from 'events'
|
|
580
|
+
|
|
581
|
+
const server = createServer((request, response) => {
|
|
582
|
+
response.end('Hello, World!')
|
|
583
|
+
}).listen()
|
|
584
|
+
|
|
585
|
+
await once(server, 'listening')
|
|
586
|
+
|
|
587
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
588
|
+
const ee = new EventEmitter()
|
|
589
|
+
|
|
590
|
+
try {
|
|
591
|
+
client.request({
|
|
592
|
+
path: '/',
|
|
593
|
+
method: 'GET',
|
|
594
|
+
signal: ee
|
|
595
|
+
})
|
|
596
|
+
} catch (error) {
|
|
597
|
+
console.error(error) // should print an RequestAbortedError
|
|
598
|
+
client.close()
|
|
599
|
+
server.close()
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
ee.emit('abort')
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
Destroying the request or response body will have the same effect.
|
|
606
|
+
|
|
607
|
+
```js
|
|
608
|
+
import { createServer } from 'http'
|
|
609
|
+
import { Client } from 'undici'
|
|
610
|
+
import { once } from 'events'
|
|
611
|
+
|
|
612
|
+
const server = createServer((request, response) => {
|
|
613
|
+
response.end('Hello, World!')
|
|
614
|
+
}).listen()
|
|
615
|
+
|
|
616
|
+
await once(server, 'listening')
|
|
617
|
+
|
|
618
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
619
|
+
|
|
620
|
+
try {
|
|
621
|
+
const { body } = await client.request({
|
|
622
|
+
path: '/',
|
|
623
|
+
method: 'GET'
|
|
624
|
+
})
|
|
625
|
+
body.destroy()
|
|
626
|
+
} catch (error) {
|
|
627
|
+
console.error(error) // should print an RequestAbortedError
|
|
628
|
+
client.close()
|
|
629
|
+
server.close()
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
#### Example 3 - Conditionally reading the body
|
|
634
|
+
|
|
635
|
+
Remember to fully consume the body even in the case when it is not read.
|
|
636
|
+
|
|
637
|
+
```js
|
|
638
|
+
const { body, statusCode } = await client.request({
|
|
639
|
+
path: '/',
|
|
640
|
+
method: 'GET'
|
|
641
|
+
})
|
|
545
642
|
|
|
546
643
|
if (statusCode === 200) {
|
|
547
644
|
return await body.arrayBuffer()
|
|
@@ -552,42 +649,40 @@ await body.dump()
|
|
|
552
649
|
return null
|
|
553
650
|
```
|
|
554
651
|
|
|
555
|
-
### `
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
*
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
```mjs
|
|
587
|
-
import { createServer } from 'node:http'
|
|
652
|
+
### `Dispatcher.stream(options, factory[, callback])`
|
|
653
|
+
|
|
654
|
+
A faster version of `Dispatcher.request`. This method expects the second argument `factory` to return a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream which the response will be written to. This improves performance by avoiding creating an intermediate [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) stream when the user expects to directly pipe the response body to a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream.
|
|
655
|
+
|
|
656
|
+
As demonstrated in [Example 1 - Basic GET stream request](/docs/docs/api/Dispatcher.md#example-1-basic-get-stream-request), it is recommended to use the `option.opaque` property to avoid creating a closure for the `factory` method. This pattern works well with Node.js Web Frameworks such as [Fastify](https://fastify.io). See [Example 2 - Stream to Fastify Response](/docs/docs/api/Dispatch.md#example-2-stream-to-fastify-response) for more details.
|
|
657
|
+
|
|
658
|
+
Arguments:
|
|
659
|
+
|
|
660
|
+
* **options** `RequestOptions`
|
|
661
|
+
* **factory** `(data: StreamFactoryData) => stream.Writable`
|
|
662
|
+
* **callback** `(error: Error | null, data: StreamData) => void` (optional)
|
|
663
|
+
|
|
664
|
+
Returns: `void | Promise<StreamData>` - Only returns a `Promise` if no `callback` argument was passed
|
|
665
|
+
|
|
666
|
+
#### Parameter: `StreamFactoryData`
|
|
667
|
+
|
|
668
|
+
* **statusCode** `number`
|
|
669
|
+
* **headers** `Record<string, string | string[] | undefined>`
|
|
670
|
+
* **opaque** `unknown`
|
|
671
|
+
* **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
|
|
672
|
+
|
|
673
|
+
#### Parameter: `StreamData`
|
|
674
|
+
|
|
675
|
+
* **opaque** `unknown`
|
|
676
|
+
* **trailers** `Record<string, string>`
|
|
677
|
+
* **context** `object`
|
|
678
|
+
|
|
679
|
+
#### Example 1 - Basic GET stream request
|
|
680
|
+
|
|
681
|
+
```js
|
|
682
|
+
import { createServer } from 'http'
|
|
588
683
|
import { Client } from 'undici'
|
|
589
|
-
import { once } from '
|
|
590
|
-
import { Writable } from '
|
|
684
|
+
import { once } from 'events'
|
|
685
|
+
import { Writable } from 'stream'
|
|
591
686
|
|
|
592
687
|
const server = createServer((request, response) => {
|
|
593
688
|
response.end('Hello, World!')
|
|
@@ -624,38 +719,95 @@ try {
|
|
|
624
719
|
}
|
|
625
720
|
```
|
|
626
721
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
722
|
+
#### Example 2 - Stream to Fastify Response
|
|
723
|
+
|
|
724
|
+
In this example, a (fake) request is made to the fastify server using `fastify.inject()`. This request then executes the fastify route handler which makes a subsequent request to the raw Node.js http server using `undici.dispatcher.stream()`. The fastify response is passed to the `opaque` option so that undici can tap into the underlying writable stream using `response.raw`. This methodology demonstrates how one could use undici and fastify together to create fast-as-possible requests from one backend server to another.
|
|
725
|
+
|
|
726
|
+
```js
|
|
727
|
+
import { createServer } from 'http'
|
|
728
|
+
import { Client } from 'undici'
|
|
729
|
+
import { once } from 'events'
|
|
730
|
+
import fastify from 'fastify'
|
|
731
|
+
|
|
732
|
+
const nodeServer = createServer((request, response) => {
|
|
733
|
+
response.end('Hello, World! From Node.js HTTP Server')
|
|
734
|
+
}).listen()
|
|
735
|
+
|
|
736
|
+
await once(nodeServer, 'listening')
|
|
737
|
+
|
|
738
|
+
console.log('Node Server listening')
|
|
739
|
+
|
|
740
|
+
const nodeServerUndiciClient = new Client(`http://localhost:${nodeServer.address().port}`)
|
|
741
|
+
|
|
742
|
+
const fastifyServer = fastify()
|
|
743
|
+
|
|
744
|
+
fastifyServer.route({
|
|
745
|
+
url: '/',
|
|
746
|
+
method: 'GET',
|
|
747
|
+
handler: (request, response) => {
|
|
748
|
+
nodeServerUndiciClient.stream({
|
|
749
|
+
path: '/',
|
|
750
|
+
method: 'GET',
|
|
751
|
+
opaque: response
|
|
752
|
+
}, ({ opaque }) => opaque.raw)
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
|
|
756
|
+
await fastifyServer.listen()
|
|
757
|
+
|
|
758
|
+
console.log('Fastify Server listening')
|
|
759
|
+
|
|
760
|
+
const fastifyServerUndiciClient = new Client(`http://localhost:${fastifyServer.server.address().port}`)
|
|
761
|
+
|
|
762
|
+
try {
|
|
763
|
+
const { statusCode, body } = await fastifyServerUndiciClient.request({
|
|
764
|
+
path: '/',
|
|
765
|
+
method: 'GET'
|
|
766
|
+
})
|
|
767
|
+
|
|
768
|
+
console.log(`response received ${statusCode}`)
|
|
769
|
+
body.setEncoding('utf8')
|
|
770
|
+
body.on('data', console.log)
|
|
771
|
+
|
|
772
|
+
nodeServerUndiciClient.close()
|
|
773
|
+
fastifyServerUndiciClient.close()
|
|
774
|
+
fastifyServer.close()
|
|
775
|
+
nodeServer.close()
|
|
776
|
+
} catch (error) { }
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### `Dispatcher.upgrade(options[, callback])`
|
|
780
|
+
|
|
781
|
+
Upgrade to a different protocol. Visit [MDN - HTTP - Protocol upgrade mechanism](https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) for more details.
|
|
782
|
+
|
|
783
|
+
Arguments:
|
|
784
|
+
|
|
785
|
+
* **options** `UpgradeOptions`
|
|
786
|
+
|
|
787
|
+
* **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
|
|
788
|
+
|
|
789
|
+
Returns: `void | Promise<UpgradeData>` - Only returns a `Promise` if no `callback` argument was passed
|
|
790
|
+
|
|
791
|
+
#### Parameter: `UpgradeOptions`
|
|
792
|
+
|
|
793
|
+
* **path** `string`
|
|
794
|
+
* **method** `string` (optional) - Default: `'GET'`
|
|
795
|
+
* **headers** `UndiciHeaders` (optional) - Default: `null`
|
|
796
|
+
* **protocol** `string` (optional) - Default: `'Websocket'` - A string of comma separated protocols, in descending preference order.
|
|
797
|
+
* **signal** `AbortSignal | EventEmitter | null` (optional) - Default: `null`
|
|
798
|
+
|
|
799
|
+
#### Parameter: `UpgradeData`
|
|
800
|
+
|
|
801
|
+
* **headers** `http.IncomingHeaders`
|
|
802
|
+
* **socket** `stream.Duplex`
|
|
803
|
+
* **opaque** `unknown`
|
|
804
|
+
|
|
805
|
+
#### Example 1 - Basic Upgrade Request
|
|
806
|
+
|
|
807
|
+
```js
|
|
808
|
+
import { createServer } from 'http'
|
|
657
809
|
import { Client } from 'undici'
|
|
658
|
-
import { once } from '
|
|
810
|
+
import { once } from 'events'
|
|
659
811
|
|
|
660
812
|
const server = createServer((request, response) => {
|
|
661
813
|
response.statusCode = 101
|
|
@@ -669,7 +821,9 @@ await once(server, 'listening')
|
|
|
669
821
|
const client = new Client(`http://localhost:${server.address().port}`)
|
|
670
822
|
|
|
671
823
|
try {
|
|
672
|
-
const { headers, socket } = await client.upgrade({
|
|
824
|
+
const { headers, socket } = await client.upgrade({
|
|
825
|
+
path: '/',
|
|
826
|
+
})
|
|
673
827
|
socket.on('end', () => {
|
|
674
828
|
console.log(`upgrade: ${headers.upgrade}`) // upgrade: Websocket
|
|
675
829
|
client.close()
|
|
@@ -683,62 +837,109 @@ try {
|
|
|
683
837
|
}
|
|
684
838
|
```
|
|
685
839
|
|
|
686
|
-
### `
|
|
840
|
+
### `Dispatcher.compose(interceptors[, interceptor])`
|
|
687
841
|
|
|
688
|
-
|
|
689
|
-
added: v6.9.0
|
|
690
|
-
-->
|
|
842
|
+
Compose a new dispatcher from the current dispatcher and the given interceptors.
|
|
691
843
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
844
|
+
> _Notes_:
|
|
845
|
+
> - The order of the interceptors matters. The last interceptor will be the first to be called.
|
|
846
|
+
> - It is important to note that the `interceptor` function should return a function that follows the `Dispatcher.dispatch` signature.
|
|
847
|
+
> - Any fork of the chain of `interceptors` can lead to unexpected results.
|
|
848
|
+
>
|
|
849
|
+
> **Interceptor Stack Visualization:**
|
|
850
|
+
> ```
|
|
851
|
+
> compose([interceptor1, interceptor2, interceptor3])
|
|
852
|
+
>
|
|
853
|
+
> Request Flow:
|
|
854
|
+
> ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
855
|
+
> │ Request │───▶│interceptor3 │───▶│interceptor2 │───▶│interceptor1 │───▶│ dispatcher │
|
|
856
|
+
> └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ .dispatch │
|
|
857
|
+
> ▲ ▲ ▲ └─────────────┘
|
|
858
|
+
> │ │ │ ▲
|
|
859
|
+
> (called first) (called second) (called last) │
|
|
860
|
+
> │
|
|
861
|
+
> ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
862
|
+
> │ Response │◀───│interceptor3 │◀───│interceptor2 │◀───│interceptor1 │◀─────────┘
|
|
863
|
+
> └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
|
864
|
+
>
|
|
865
|
+
> The interceptors are composed in reverse order due to function composition.
|
|
866
|
+
> ```
|
|
698
867
|
|
|
699
|
-
|
|
700
|
-
interceptors. Each interceptor is a function that takes a `dispatch` method and
|
|
701
|
-
returns a `dispatch`-like function with the same signature
|
|
702
|
-
(`(options, handler)`).
|
|
868
|
+
Arguments:
|
|
703
869
|
|
|
704
|
-
|
|
705
|
-
first to be called. Forking the chain of interceptors can lead to unexpected
|
|
706
|
-
results.
|
|
870
|
+
* **interceptors** `Interceptor[interceptor[]]`: It is an array of `Interceptor` functions passed as only argument, or several interceptors passed as separate arguments.
|
|
707
871
|
|
|
708
|
-
|
|
709
|
-
compose([interceptor1, interceptor2, interceptor3])
|
|
872
|
+
Returns: `Dispatcher`.
|
|
710
873
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
```
|
|
874
|
+
#### Parameter: `Interceptor`
|
|
875
|
+
|
|
876
|
+
A function that takes a `dispatch` method and returns a `dispatch`-like function.
|
|
715
877
|
|
|
716
|
-
|
|
717
|
-
|
|
878
|
+
#### Example 1 - Basic Compose
|
|
879
|
+
|
|
880
|
+
```js
|
|
881
|
+
const { Client, RedirectHandler } = require('undici')
|
|
718
882
|
|
|
719
883
|
const redirectInterceptor = dispatch => {
|
|
720
|
-
|
|
721
|
-
|
|
884
|
+
return (opts, handler) => {
|
|
885
|
+
const { maxRedirections } = opts
|
|
722
886
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
887
|
+
if (!maxRedirections) {
|
|
888
|
+
return dispatch(opts, handler)
|
|
889
|
+
}
|
|
726
890
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
891
|
+
const redirectHandler = new RedirectHandler(
|
|
892
|
+
dispatch,
|
|
893
|
+
maxRedirections,
|
|
894
|
+
opts,
|
|
895
|
+
handler
|
|
896
|
+
)
|
|
897
|
+
opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
|
|
898
|
+
return dispatch(opts, redirectHandler)
|
|
899
|
+
}
|
|
731
900
|
}
|
|
732
901
|
|
|
733
|
-
const client = new Client('http://localhost:3000')
|
|
902
|
+
const client = new Client('http://localhost:3000')
|
|
903
|
+
.compose(redirectInterceptor)
|
|
734
904
|
|
|
735
905
|
await client.request({ path: '/', method: 'GET' })
|
|
736
906
|
```
|
|
737
907
|
|
|
738
|
-
|
|
908
|
+
#### Example 2 - Chained Compose
|
|
739
909
|
|
|
740
|
-
```
|
|
741
|
-
|
|
910
|
+
```js
|
|
911
|
+
const { Client, RedirectHandler, RetryHandler } = require('undici')
|
|
912
|
+
|
|
913
|
+
const redirectInterceptor = dispatch => {
|
|
914
|
+
return (opts, handler) => {
|
|
915
|
+
const { maxRedirections } = opts
|
|
916
|
+
|
|
917
|
+
if (!maxRedirections) {
|
|
918
|
+
return dispatch(opts, handler)
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
const redirectHandler = new RedirectHandler(
|
|
922
|
+
dispatch,
|
|
923
|
+
maxRedirections,
|
|
924
|
+
opts,
|
|
925
|
+
handler
|
|
926
|
+
)
|
|
927
|
+
opts = { ...opts, maxRedirections: 0 }
|
|
928
|
+
return dispatch(opts, redirectHandler)
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
const retryInterceptor = dispatch => {
|
|
933
|
+
return function retryInterceptor (opts, handler) {
|
|
934
|
+
return dispatch(
|
|
935
|
+
opts,
|
|
936
|
+
new RetryHandler(opts, {
|
|
937
|
+
handler,
|
|
938
|
+
dispatch
|
|
939
|
+
})
|
|
940
|
+
)
|
|
941
|
+
}
|
|
942
|
+
}
|
|
742
943
|
|
|
743
944
|
const client = new Client('http://localhost:3000')
|
|
744
945
|
.compose(redirectInterceptor)
|
|
@@ -747,96 +948,446 @@ const client = new Client('http://localhost:3000')
|
|
|
747
948
|
await client.request({ path: '/', method: 'GET' })
|
|
748
949
|
```
|
|
749
950
|
|
|
750
|
-
|
|
751
|
-
For an example of a custom interceptor that wraps handler callbacks, see
|
|
752
|
-
[Custom interceptors](Interceptors.md#custom-interceptors).
|
|
951
|
+
#### Pre-built interceptors
|
|
753
952
|
|
|
754
|
-
|
|
953
|
+
##### `redirect`
|
|
954
|
+
|
|
955
|
+
The `redirect` interceptor allows you to customize the way your dispatcher handles redirects.
|
|
956
|
+
|
|
957
|
+
It accepts the same arguments as the [`RedirectHandler` constructor](/docs/docs/api/RedirectHandler.md).
|
|
958
|
+
|
|
959
|
+
**Example - Basic Redirect Interceptor**
|
|
960
|
+
|
|
961
|
+
```js
|
|
962
|
+
const { Client, interceptors } = require("undici");
|
|
963
|
+
const { redirect } = interceptors;
|
|
964
|
+
|
|
965
|
+
const client = new Client("http://service.example").compose(
|
|
966
|
+
redirect({ maxRedirections: 3, throwOnMaxRedirect: true })
|
|
967
|
+
);
|
|
968
|
+
client.request({ path: "/" })
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
##### `retry`
|
|
972
|
+
|
|
973
|
+
The `retry` interceptor allows you to customize the way your dispatcher handles retries.
|
|
974
|
+
|
|
975
|
+
It accepts the same arguments as the [`RetryHandler` constructor](/docs/docs/api/RetryHandler.md).
|
|
976
|
+
|
|
977
|
+
**Example - Basic Redirect Interceptor**
|
|
978
|
+
|
|
979
|
+
```js
|
|
980
|
+
const { Client, interceptors } = require("undici");
|
|
981
|
+
const { retry } = interceptors;
|
|
982
|
+
|
|
983
|
+
const client = new Client("http://service.example").compose(
|
|
984
|
+
retry({
|
|
985
|
+
maxRetries: 3,
|
|
986
|
+
minTimeout: 1000,
|
|
987
|
+
maxTimeout: 10000,
|
|
988
|
+
timeoutFactor: 2,
|
|
989
|
+
retryAfter: true,
|
|
990
|
+
})
|
|
991
|
+
);
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
##### `dump`
|
|
995
|
+
|
|
996
|
+
The `dump` interceptor enables you to dump the response body from a request upon a given limit.
|
|
997
|
+
|
|
998
|
+
**Options**
|
|
999
|
+
- `maxSize` - The maximum size (in bytes) of the response body to dump. If the size of the request's body exceeds this value then the connection will be closed. Default: `1048576`.
|
|
1000
|
+
|
|
1001
|
+
> The `Dispatcher#options` also gets extended with the options `dumpMaxSize`, `abortOnDumped`, and `waitForTrailers` which can be used to configure the interceptor at a request-per-request basis.
|
|
1002
|
+
|
|
1003
|
+
**Example - Basic Dump Interceptor**
|
|
1004
|
+
|
|
1005
|
+
```js
|
|
1006
|
+
const { Client, interceptors } = require("undici");
|
|
1007
|
+
const { dump } = interceptors;
|
|
1008
|
+
|
|
1009
|
+
const client = new Client("http://service.example").compose(
|
|
1010
|
+
dump({
|
|
1011
|
+
maxSize: 1024,
|
|
1012
|
+
})
|
|
1013
|
+
);
|
|
1014
|
+
|
|
1015
|
+
// or
|
|
1016
|
+
client.dispatch(
|
|
1017
|
+
{
|
|
1018
|
+
path: "/",
|
|
1019
|
+
method: "GET",
|
|
1020
|
+
dumpMaxSize: 1024,
|
|
1021
|
+
},
|
|
1022
|
+
handler
|
|
1023
|
+
);
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
##### `dns`
|
|
1027
|
+
|
|
1028
|
+
The `dns` interceptor enables you to cache DNS lookups for a given duration, per origin.
|
|
1029
|
+
|
|
1030
|
+
>It is well suited for scenarios where you want to cache DNS lookups to avoid the overhead of resolving the same domain multiple times
|
|
1031
|
+
|
|
1032
|
+
**Options**
|
|
1033
|
+
- `maxTTL` - The maximum time-to-live (in milliseconds) of the DNS cache. It should be a positive integer. Default: `10000`.
|
|
1034
|
+
- Set `0` to disable TTL.
|
|
1035
|
+
- `maxItems` - The maximum number of items to cache. It should be a positive integer. Default: `Infinity`.
|
|
1036
|
+
- `dualStack` - Whether to resolve both IPv4 and IPv6 addresses. Default: `true`.
|
|
1037
|
+
- It will also attempt a happy-eyeballs-like approach to connect to the available addresses in case of a connection failure.
|
|
1038
|
+
- `affinity` - Whether to use IPv4 or IPv6 addresses. Default: `4`.
|
|
1039
|
+
- It can be either `4` or `6`.
|
|
1040
|
+
- It will only take effect if `dualStack` is `false`.
|
|
1041
|
+
- `lookup: (hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void` - Custom lookup function. Default: `dns.lookup`.
|
|
1042
|
+
- For more info see [dns.lookup](https://nodejs.org/api/dns.html#dnslookuphostname-options-callback).
|
|
1043
|
+
- `pick: (origin: URL, records: DNSInterceptorRecords, affinity: 4 | 6) => DNSInterceptorRecord` - Custom pick function. Default: `RoundRobin`.
|
|
1044
|
+
- The function should return a single record from the records array.
|
|
1045
|
+
- By default a simplified version of Round Robin is used.
|
|
1046
|
+
- The `records` property can be mutated to store the state of the balancing algorithm.
|
|
1047
|
+
- `storage: DNSStorage` - Custom storage for resolved DNS records
|
|
1048
|
+
|
|
1049
|
+
> The `Dispatcher#options` also gets extended with the options `dns.affinity`, `dns.dualStack`, `dns.lookup` and `dns.pick` which can be used to configure the interceptor at a request-per-request basis.
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
**DNSInterceptorRecord**
|
|
1053
|
+
It represents a DNS record.
|
|
1054
|
+
- `family` - (`number`) The IP family of the address. It can be either `4` or `6`.
|
|
1055
|
+
- `address` - (`string`) The IP address.
|
|
1056
|
+
|
|
1057
|
+
**DNSInterceptorOriginRecords**
|
|
1058
|
+
It represents a map of DNS IP addresses records for a single origin.
|
|
1059
|
+
- `4.ips` - (`DNSInterceptorRecord[] | null`) The IPv4 addresses.
|
|
1060
|
+
- `6.ips` - (`DNSInterceptorRecord[] | null`) The IPv6 addresses.
|
|
1061
|
+
|
|
1062
|
+
**DNSStorage**
|
|
1063
|
+
It represents a storage object for resolved DNS records.
|
|
1064
|
+
- `size` - (`number`) current size of the storage.
|
|
1065
|
+
- `get` - (`(origin: string) => DNSInterceptorOriginRecords | null`) method to get the records for a given origin.
|
|
1066
|
+
- `set` - (`(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }) => void`) method to set the records for a given origin.
|
|
1067
|
+
- `delete` - (`(origin: string) => void`) method to delete records for a given origin.
|
|
1068
|
+
- `full` - (`() => boolean`) method to check if the storage is full, if returns `true`, DNS lookup will be skipped in this interceptor and new records will not be stored.
|
|
1069
|
+
|
|
1070
|
+
**Example - Basic DNS Interceptor**
|
|
1071
|
+
|
|
1072
|
+
```js
|
|
1073
|
+
const { Client, interceptors } = require("undici");
|
|
1074
|
+
const { dns } = interceptors;
|
|
1075
|
+
|
|
1076
|
+
const client = new Agent().compose([
|
|
1077
|
+
dns({ ...opts })
|
|
1078
|
+
])
|
|
1079
|
+
|
|
1080
|
+
const response = await client.request({
|
|
1081
|
+
origin: `http://localhost:3030`,
|
|
1082
|
+
...requestOpts
|
|
1083
|
+
})
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
**Example - DNS Interceptor and LRU cache as a storage**
|
|
1087
|
+
|
|
1088
|
+
```js
|
|
1089
|
+
const { Client, interceptors } = require("undici");
|
|
1090
|
+
const QuickLRU = require("quick-lru");
|
|
1091
|
+
const { dns } = interceptors;
|
|
1092
|
+
|
|
1093
|
+
const lru = new QuickLRU({ maxSize: 100 });
|
|
1094
|
+
|
|
1095
|
+
const lruAdapter = {
|
|
1096
|
+
get size() {
|
|
1097
|
+
return lru.size;
|
|
1098
|
+
},
|
|
1099
|
+
get(origin) {
|
|
1100
|
+
return lru.get(origin);
|
|
1101
|
+
},
|
|
1102
|
+
set(origin, records, { ttl }) {
|
|
1103
|
+
lru.set(origin, records, { maxAge: ttl });
|
|
1104
|
+
},
|
|
1105
|
+
delete(origin) {
|
|
1106
|
+
lru.delete(origin);
|
|
1107
|
+
},
|
|
1108
|
+
full() {
|
|
1109
|
+
// For LRU cache, we can always store new records,
|
|
1110
|
+
// old records will be evicted automatically
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
const client = new Agent().compose([
|
|
1116
|
+
dns({ storage: lruAdapter })
|
|
1117
|
+
])
|
|
1118
|
+
|
|
1119
|
+
const response = await client.request({
|
|
1120
|
+
origin: `http://localhost:3030`,
|
|
1121
|
+
...requestOpts
|
|
1122
|
+
})
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
##### `responseError`
|
|
1126
|
+
|
|
1127
|
+
The `responseError` interceptor throws an error for responses with status code errors (>= 400).
|
|
1128
|
+
|
|
1129
|
+
**Example**
|
|
1130
|
+
|
|
1131
|
+
```js
|
|
1132
|
+
const { Client, interceptors } = require("undici");
|
|
1133
|
+
const { responseError } = interceptors;
|
|
1134
|
+
|
|
1135
|
+
const client = new Client("http://service.example").compose(
|
|
1136
|
+
responseError()
|
|
1137
|
+
);
|
|
1138
|
+
|
|
1139
|
+
// Will throw a ResponseError for status codes >= 400
|
|
1140
|
+
await client.request({
|
|
1141
|
+
method: "GET",
|
|
1142
|
+
path: "/"
|
|
1143
|
+
});
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
##### `decompress`
|
|
1147
|
+
|
|
1148
|
+
⚠️ The decompress interceptor is experimental and subject to change.
|
|
1149
|
+
|
|
1150
|
+
The `decompress` interceptor automatically decompresses response bodies that are compressed with gzip, deflate, brotli, or zstd compression. It removes the `content-encoding` and `content-length` headers from decompressed responses and supports RFC-9110 compliant multiple encodings.
|
|
1151
|
+
|
|
1152
|
+
**Options**
|
|
1153
|
+
|
|
1154
|
+
- `skipErrorResponses` - Whether to skip decompression for error responses (status codes >= 400). Default: `true`.
|
|
1155
|
+
- `skipStatusCodes` - Array of status codes to skip decompression for. Default: `[204, 304]`.
|
|
1156
|
+
- `maxSize` - Maximum decompressed response size in bytes for each decompression stage. Set to `0` to disable the limit. Default: `0`.
|
|
1157
|
+
|
|
1158
|
+
**Example - Basic Decompress Interceptor**
|
|
1159
|
+
|
|
1160
|
+
```js
|
|
1161
|
+
const { Client, interceptors } = require("undici");
|
|
1162
|
+
const { decompress } = interceptors;
|
|
1163
|
+
|
|
1164
|
+
const client = new Client("http://service.example").compose(
|
|
1165
|
+
decompress()
|
|
1166
|
+
);
|
|
1167
|
+
|
|
1168
|
+
// Automatically decompresses gzip/deflate/brotli/zstd responses
|
|
1169
|
+
const response = await client.request({
|
|
1170
|
+
method: "GET",
|
|
1171
|
+
path: "/"
|
|
1172
|
+
});
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
**Example - Custom Options**
|
|
1176
|
+
|
|
1177
|
+
```js
|
|
1178
|
+
const { Client, interceptors } = require("undici");
|
|
1179
|
+
const { decompress } = interceptors;
|
|
1180
|
+
|
|
1181
|
+
const client = new Client("http://service.example").compose(
|
|
1182
|
+
decompress({
|
|
1183
|
+
skipErrorResponses: false, // Decompress 5xx responses
|
|
1184
|
+
skipStatusCodes: [204, 304, 201] // Skip these status codes
|
|
1185
|
+
})
|
|
1186
|
+
);
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
**Supported Encodings**
|
|
1190
|
+
|
|
1191
|
+
- `gzip` / `x-gzip` - GZIP compression
|
|
1192
|
+
- `deflate` / `x-compress` - DEFLATE compression
|
|
1193
|
+
- `br` - Brotli compression
|
|
1194
|
+
- `zstd` - Zstandard compression
|
|
1195
|
+
- Multiple encodings (e.g., `gzip, deflate`) are supported per RFC-9110
|
|
1196
|
+
|
|
1197
|
+
**Behavior**
|
|
1198
|
+
|
|
1199
|
+
- Skips decompression for status codes < 200 or >= 400 (configurable)
|
|
1200
|
+
- Skips decompression for 204 No Content and 304 Not Modified by default
|
|
1201
|
+
- Removes `content-encoding` and `content-length` headers when decompressing
|
|
1202
|
+
- Passes through unsupported encodings unchanged
|
|
1203
|
+
- Handles case-insensitive encoding names
|
|
1204
|
+
- Supports streaming decompression without buffering
|
|
1205
|
+
|
|
1206
|
+
##### `Cache Interceptor`
|
|
1207
|
+
|
|
1208
|
+
The `cache` interceptor implements client-side response caching as described in
|
|
1209
|
+
[RFC9111](https://www.rfc-editor.org/rfc/rfc9111.html).
|
|
755
1210
|
|
|
756
|
-
|
|
757
|
-
added: v4.0.0
|
|
758
|
-
-->
|
|
1211
|
+
**Options**
|
|
759
1212
|
|
|
760
|
-
|
|
761
|
-
|
|
1213
|
+
- `store` - The [`CacheStore`](/docs/docs/api/CacheStore.md) to store and retrieve responses from. Default is [`MemoryCacheStore`](/docs/docs/api/CacheStore.md#memorycachestore).
|
|
1214
|
+
- `methods` - The [**safe** HTTP methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1) to cache the response of.
|
|
1215
|
+
- `cacheByDefault` - The default expiration time to cache responses by if they don't have an explicit expiration and cannot have an heuristic expiry computed. If this isn't present, responses neither with an explicit expiration nor heuristically cacheable will not be cached. Default `undefined`.
|
|
1216
|
+
- `type` - The [type of cache](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching#types_of_caches) for Undici to act as. Can be `shared` or `private`. Default `shared`. `private` implies privately cacheable responses will be cached and potentially shared with other users of your application.
|
|
762
1217
|
|
|
763
|
-
|
|
1218
|
+
**Usage with `fetch`**
|
|
1219
|
+
|
|
1220
|
+
```js
|
|
1221
|
+
const { Agent, cacheStores, interceptors, setGlobalDispatcher } = require('undici')
|
|
1222
|
+
|
|
1223
|
+
const client = new Agent().compose(interceptors.cache({
|
|
1224
|
+
store: new cacheStores.MemoryCacheStore({
|
|
1225
|
+
maxSize: 100 * 1024 * 1024, // 100MB
|
|
1226
|
+
maxCount: 1000,
|
|
1227
|
+
maxEntrySize: 5 * 1024 * 1024 // 5MB
|
|
1228
|
+
})
|
|
1229
|
+
}))
|
|
1230
|
+
|
|
1231
|
+
setGlobalDispatcher(client)
|
|
1232
|
+
|
|
1233
|
+
// First request goes to the network and is cached when cache headers allow it.
|
|
1234
|
+
const first = await fetch('https://example.com/data')
|
|
1235
|
+
|
|
1236
|
+
// Second request can be served from cache according to RFC9111 rules.
|
|
1237
|
+
const second = await fetch('https://example.com/data')
|
|
1238
|
+
```
|
|
1239
|
+
|
|
1240
|
+
##### `Deduplicate Interceptor`
|
|
1241
|
+
|
|
1242
|
+
The `deduplicate` interceptor deduplicates concurrent identical requests. When multiple identical requests are made while one is already in-flight, only one request is sent to the origin server, and all waiting handlers receive the same response. This reduces server load and improves performance.
|
|
1243
|
+
|
|
1244
|
+
**Options**
|
|
1245
|
+
|
|
1246
|
+
- `methods` - The [**safe** HTTP methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1) to deduplicate. Default `['GET']`.
|
|
1247
|
+
- `skipHeaderNames` - Header names that, if present in a request, will cause the request to skip deduplication entirely. Useful for headers like `idempotency-key` where presence indicates unique processing. Header name matching is case-insensitive. Default `[]`.
|
|
1248
|
+
- `excludeHeaderNames` - Header names to exclude from the deduplication key. Requests with different values for these headers will still be deduplicated together. Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication. Header name matching is case-insensitive. Default `[]`.
|
|
1249
|
+
- `maxBufferSize` - Maximum bytes buffered per paused waiting deduplicated handler. If a waiting handler remains paused and exceeds this threshold, it is failed with an abort error to prevent unbounded memory growth. Default `5 * 1024 * 1024`.
|
|
1250
|
+
|
|
1251
|
+
**Usage**
|
|
1252
|
+
|
|
1253
|
+
```js
|
|
1254
|
+
const { Client, interceptors } = require("undici");
|
|
1255
|
+
const { deduplicate, cache } = interceptors;
|
|
1256
|
+
|
|
1257
|
+
// Deduplicate only
|
|
1258
|
+
const client = new Client("http://service.example").compose(
|
|
1259
|
+
deduplicate()
|
|
1260
|
+
);
|
|
1261
|
+
|
|
1262
|
+
// Deduplicate with caching
|
|
1263
|
+
const clientWithCache = new Client("http://service.example").compose(
|
|
1264
|
+
deduplicate(),
|
|
1265
|
+
cache()
|
|
1266
|
+
);
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
Requests are considered identical if they have the same:
|
|
1270
|
+
- Origin
|
|
1271
|
+
- HTTP method
|
|
1272
|
+
- Path
|
|
1273
|
+
- Request headers (excluding any headers specified in `excludeHeaderNames`)
|
|
1274
|
+
|
|
1275
|
+
All deduplicated requests receive the complete response including status code, headers, and body.
|
|
1276
|
+
|
|
1277
|
+
For observability, request deduplication events are published to the `undici:request:pending-requests` [diagnostic channel](/docs/docs/api/DiagnosticsChannel.md#undicirequestpending-requests).
|
|
1278
|
+
|
|
1279
|
+
## Instance Events
|
|
1280
|
+
|
|
1281
|
+
### Event: `'connect'`
|
|
1282
|
+
|
|
1283
|
+
Parameters:
|
|
1284
|
+
|
|
1285
|
+
* **origin** `URL`
|
|
1286
|
+
* **targets** `Array<Dispatcher>`
|
|
764
1287
|
|
|
765
1288
|
### Event: `'disconnect'`
|
|
766
1289
|
|
|
767
|
-
|
|
768
|
-
added: v4.0.0
|
|
769
|
-
-->
|
|
1290
|
+
Parameters:
|
|
770
1291
|
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
1292
|
+
* **origin** `URL`
|
|
1293
|
+
* **targets** `Array<Dispatcher>`
|
|
1294
|
+
* **error** `Error`
|
|
774
1295
|
|
|
775
1296
|
Emitted when the dispatcher has been disconnected from the origin.
|
|
776
1297
|
|
|
777
|
-
For HTTP/2, this event is also emitted when the dispatcher
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
protocol, a request may hang if a frame is received between the `HEADER` and
|
|
781
|
-
`DATA` frames. It is recommended to handle this event and close the dispatcher to
|
|
782
|
-
create a new HTTP/2 session.
|
|
1298
|
+
> **Note**: For HTTP/2, this event is also emitted when the dispatcher has received the [GOAWAY Frame](https://webconcepts.info/concepts/http2-frame-type/0x7) with an Error with the message `HTTP/2: "GOAWAY" frame received` and the code `UND_ERR_INFO`.
|
|
1299
|
+
> Due to nature of the protocol of using binary frames, it is possible that requests gets hanging as a frame can be received between the `HEADER` and `DATA` frames.
|
|
1300
|
+
> It is recommended to handle this event and close the dispatcher to create a new HTTP/2 session.
|
|
783
1301
|
|
|
784
1302
|
### Event: `'connectionError'`
|
|
785
1303
|
|
|
786
|
-
|
|
787
|
-
added: v4.0.0
|
|
788
|
-
-->
|
|
1304
|
+
Parameters:
|
|
789
1305
|
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
1306
|
+
* **origin** `URL`
|
|
1307
|
+
* **targets** `Array<Dispatcher>`
|
|
1308
|
+
* **error** `Error`
|
|
793
1309
|
|
|
794
|
-
Emitted when
|
|
1310
|
+
Emitted when dispatcher fails to connect to
|
|
1311
|
+
origin.
|
|
795
1312
|
|
|
796
1313
|
### Event: `'drain'`
|
|
797
1314
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
[
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
[
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1315
|
+
Parameters:
|
|
1316
|
+
|
|
1317
|
+
* **origin** `URL`
|
|
1318
|
+
|
|
1319
|
+
Emitted when dispatcher is no longer busy.
|
|
1320
|
+
|
|
1321
|
+
## Parameter: `UndiciHeaders`
|
|
1322
|
+
|
|
1323
|
+
* `Record<string, string | string[] | undefined> | string[] | Iterable<[string, string | string[] | undefined]> | null`
|
|
1324
|
+
|
|
1325
|
+
Header arguments such as `options.headers` in [`Client.dispatch`](/docs/docs/api/Client.md#clientdispatchoptions-handlers) can be specified in three forms:
|
|
1326
|
+
* As an object specified by the `Record<string, string | string[] | undefined>` (`IncomingHttpHeaders`) type.
|
|
1327
|
+
* As an array of strings. An array representation of a header list must have an even length, or an `InvalidArgumentError` will be thrown.
|
|
1328
|
+
* As an iterable that can encompass `Headers`, `Map`, or a custom iterator returning key-value pairs.
|
|
1329
|
+
Keys are lowercase and values are not modified.
|
|
1330
|
+
|
|
1331
|
+
Undici validates header syntax at the protocol level (for example, invalid header names and invalid control characters in string values), but it does not sanitize untrusted application input. Validate and sanitize any user-provided header names and values before passing them to Undici to prevent header/body injection vulnerabilities.
|
|
1332
|
+
|
|
1333
|
+
When using the array header format (`string[]`), Undici processes only indexed elements. Additional properties assigned to the array object are ignored.
|
|
1334
|
+
|
|
1335
|
+
Response headers will derive a `host` from the `url` of the [Client](/docs/docs/api/Client.md#class-client) instance if no `host` header was previously specified.
|
|
1336
|
+
|
|
1337
|
+
### Example 1 - Object
|
|
1338
|
+
|
|
1339
|
+
```js
|
|
1340
|
+
{
|
|
1341
|
+
'content-length': '123',
|
|
1342
|
+
'content-type': 'text/plain',
|
|
1343
|
+
connection: 'keep-alive',
|
|
1344
|
+
host: 'mysite.com',
|
|
1345
|
+
accept: '*/*'
|
|
1346
|
+
}
|
|
1347
|
+
```
|
|
1348
|
+
|
|
1349
|
+
### Example 2 - Array
|
|
1350
|
+
|
|
1351
|
+
```js
|
|
1352
|
+
[
|
|
1353
|
+
'content-length', '123',
|
|
1354
|
+
'content-type', 'text/plain',
|
|
1355
|
+
'connection', 'keep-alive',
|
|
1356
|
+
'host', 'mysite.com',
|
|
1357
|
+
'accept', '*/*'
|
|
1358
|
+
]
|
|
1359
|
+
```
|
|
1360
|
+
|
|
1361
|
+
### Example 3 - Iterable
|
|
1362
|
+
|
|
1363
|
+
```js
|
|
1364
|
+
new Headers({
|
|
1365
|
+
'content-length': '123',
|
|
1366
|
+
'content-type': 'text/plain',
|
|
1367
|
+
connection: 'keep-alive',
|
|
1368
|
+
host: 'mysite.com',
|
|
1369
|
+
accept: '*/*'
|
|
1370
|
+
})
|
|
1371
|
+
```
|
|
1372
|
+
or
|
|
1373
|
+
```js
|
|
1374
|
+
new Map([
|
|
1375
|
+
['content-length', '123'],
|
|
1376
|
+
['content-type', 'text/plain'],
|
|
1377
|
+
['connection', 'keep-alive'],
|
|
1378
|
+
['host', 'mysite.com'],
|
|
1379
|
+
['accept', '*/*']
|
|
1380
|
+
])
|
|
1381
|
+
```
|
|
1382
|
+
or
|
|
1383
|
+
```js
|
|
1384
|
+
{
|
|
1385
|
+
*[Symbol.iterator] () {
|
|
1386
|
+
yield ['content-length', '123']
|
|
1387
|
+
yield ['content-type', 'text/plain']
|
|
1388
|
+
yield ['connection', 'keep-alive']
|
|
1389
|
+
yield ['host', 'mysite.com']
|
|
1390
|
+
yield ['accept', '*/*']
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
```
|