summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Luca Casonato <lucacasonato@yahoo.com> 2022-09-20 13:59:10 +0200
committerGravatar GitHub <noreply@github.com> 2022-09-20 07:59:10 -0400
commit44fa378186d711f8efab2135247ffde980e94795 (patch)
tree81c7607a79f1ec45e80f94337d9ae58b99f9bc39
parentdf54595a8836448a621fceeb38fbaacde1bb27cf (diff)
downloadastro-44fa378186d711f8efab2135247ffde980e94795.tar.gz
astro-44fa378186d711f8efab2135247ffde980e94795.tar.zst
astro-44fa378186d711f8efab2135247ffde980e94795.zip
Remove explicit `Transfer-Encoding: chunked` header (#4807)
* Remove explicit `Transfer-Encoding: chunked` This header is not necessary and is ignored by essentially all HTTP servers when provided explicitly by the user. This is because the HTTP transport layer handles adding this header automatically as needed. Some variations of HTTP transport (like HTTP/2, which is enabled by default in Deno, Netlify, and CFW) have no notion of `Transfer-Encoding: chunked`, because all responses are streamed. * add changeset
Diffstat (limited to '')
-rw-r--r--.changeset/sweet-ligers-push.md5
-rw-r--r--packages/astro/src/core/render/core.ts1
-rw-r--r--packages/astro/src/core/render/result.ts8
3 files changed, 6 insertions, 8 deletions
diff --git a/.changeset/sweet-ligers-push.md b/.changeset/sweet-ligers-push.md
new file mode 100644
index 000000000..6b50678e2
--- /dev/null
+++ b/.changeset/sweet-ligers-push.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Remove explicit `Transfer-Encoding: chunked` header from streaming responses
diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts
index e5b604cba..c9efe02de 100644
--- a/packages/astro/src/core/render/core.ts
+++ b/packages/astro/src/core/render/core.ts
@@ -149,7 +149,6 @@ export async function render(opts: RenderOptions): Promise<Response> {
site,
scripts,
ssr,
- streaming,
status,
});
diff --git a/packages/astro/src/core/render/result.ts b/packages/astro/src/core/render/result.ts
index dc5be4a07..9eb618cb3 100644
--- a/packages/astro/src/core/render/result.ts
+++ b/packages/astro/src/core/render/result.ts
@@ -27,7 +27,6 @@ function onlyAvailableInSSR(name: string) {
export interface CreateResultArgs {
adapterName: string | undefined;
ssr: boolean;
- streaming: boolean;
logging: LogOptions;
origin: string;
markdown: MarkdownRenderingOptions;
@@ -126,12 +125,7 @@ export function createResult(args: CreateResultArgs): SSRResult {
const url = new URL(request.url);
const headers = new Headers();
- if (args.streaming) {
- headers.set('Transfer-Encoding', 'chunked');
- headers.set('Content-Type', 'text/html');
- } else {
- headers.set('Content-Type', 'text/html');
- }
+ headers.set('Content-Type', 'text/html');
const response: ResponseInit = {
status: args.status,
statusText: 'OK',