mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #285] [MERGED] Default API route Content-Type to application/octet-stream #444
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#444
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/285
Author: @southpolesteve
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @southpolesteve
Base:
main← Head:fix/api-route-content-type-default📝 Commits (2)
9c605c4Default API route Content-Type to application/octet-stream8edf54fImprove test comment for Content-Type assertion📊 Changes
3 files changed (+24 additions, -1 deletions)
View changed files
📝
packages/vinext/src/server/prod-server.ts(+4 -1)➕
tests/fixtures/pages-basic/pages/api/no-content-type.ts(+9 -0)📝
tests/pages-router.test.ts(+11 -0)📄 Description
Summary
res.end()without explicitly setting aContent-Typeheader, the production server was falling back totext/html. This could cause browsers to render response bodies as HTML when the developer intended to return plain data.text/htmltoapplication/octet-stream, which is the safe default for arbitrary content. The SSR page rendering path still correctly defaults totext/html.Changes
packages/vinext/src/server/prod-server.ts: Changed thecontent-typefallback from"text/html"to"application/octet-stream"for API route responses (line 894).tests/fixtures/pages-basic/pages/api/no-content-type.ts: New fixture API route that returns a response without setting Content-Type.tests/pages-router.test.ts: New test verifying the API route content-type default is nottext/html.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.