Skip to content
Myr

doc(ssg): Define the default value for Content-Type (#2666)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* doc(ssg): Define the default value for Content-Type * denoify

authored by watany · committed by GitHub · parent d0034c6 · Browse files · 2 files+18 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−2 removed

  • other:+18 added−2 removed

2 files+18 added−2 removed

modified:deno_dist/helper/ssg/ssg.ts+9 added-1 removed
7 unmodified lines
8import { joinPaths, dirname, filterStaticGenerateRoutes } from './utils.ts'910const DEFAULT_CONCURRENCY = 2 // default concurrency for ssg1112// 'default_content_type' is designed according to Bun's performance optimization,13// which omits Content-Type by default for text responses.14// This is based on benchmarks showing performance gains without Content-Type.15// In Hono, using `c.text()` without a Content-Type implicitly assumes 'text/plain; charset=UTF-8'.16// This approach maintains performance consistency across different environments.17// For details, see GitHub issues: oven-sh/bun#8530 and https://github.com/honojs/hono/issues/2284.18const DEFAULT_CONTENT_TYPE = 'text/plain'1920/**21 * @experimental22 * `FileSystemModule` is an experimental feature.23 * The API might be changed.
164 unmodified lines
188 }189 response = maybeResponse190 }191 const mimeType =184 response.headers.get('Content-Type')?.split(';')[0] || 'text/plain'192 response.headers.get('Content-Type')?.split(';')[0] || DEFAULT_CONTENT_TYPE193 const content = await parseResponseContent(response)194 resolveReq({195 routePath: replacedUrlParam,196 mimeType,
128 unmodified lines
modified:src/helper/ssg/ssg.ts+9 added-1 removed
7 unmodified lines
8import { joinPaths, dirname, filterStaticGenerateRoutes } from './utils'910const DEFAULT_CONCURRENCY = 2 // default concurrency for ssg1112// 'default_content_type' is designed according to Bun's performance optimization,13// which omits Content-Type by default for text responses.14// This is based on benchmarks showing performance gains without Content-Type.15// In Hono, using `c.text()` without a Content-Type implicitly assumes 'text/plain; charset=UTF-8'.16// This approach maintains performance consistency across different environments.17// For details, see GitHub issues: oven-sh/bun#8530 and https://github.com/honojs/hono/issues/2284.18const DEFAULT_CONTENT_TYPE = 'text/plain'1920/**21 * @experimental22 * `FileSystemModule` is an experimental feature.23 * The API might be changed.
164 unmodified lines
188 }189 response = maybeResponse190 }191 const mimeType =184 response.headers.get('Content-Type')?.split(';')[0] || 'text/plain'192 response.headers.get('Content-Type')?.split(';')[0] || DEFAULT_CONTENT_TYPE193 const content = await parseResponseContent(response)194 resolveReq({195 routePath: replacedUrlParam,196 mimeType,
128 unmodified lines