mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #318] [MERGED] test: add unit tests for Pages Router api-handler #474
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#474
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/318
Author: @NathanDrake2406
Created: 3/7/2026
Status: ✅ Merged
Merged: 3/7/2026
Merged by: @james-elicx
Base:
main← Head:test/api-handler-coverage📝 Commits (1)
f4bca37test: add unit tests for Pages Router api-handler📊 Changes
1 file changed (+789 additions, -0 deletions)
View changed files
➕
tests/api-handler.test.ts(+789 -0)📄 Description
Summary
handleApiRoute()inserver/api-handler.tsMAX_BODY_SIZEenforcement (rejects >1MB with 413)=in values, missing header)res.status()chaining,res.json(),res.send()type inference,res.redirect()default 307 vs customssrFixStacktracecalledUses a minimal
ViteDevServermock (onlyssrLoadModule+ssrFixStacktrace) and lightweightIncomingMessage/ServerResponsemocks viaPassThroughstreams.Test plan
npx vitest run tests/api-handler.test.ts— 34/34 passing🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.