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
This commit is contained in:
parent
df54595a88
commit
44fa378186
3 changed files with 6 additions and 8 deletions
5
.changeset/sweet-ligers-push.md
Normal file
5
.changeset/sweet-ligers-push.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Remove explicit `Transfer-Encoding: chunked` header from streaming responses
|
|
@ -149,7 +149,6 @@ export async function render(opts: RenderOptions): Promise<Response> {
|
|||
site,
|
||||
scripts,
|
||||
ssr,
|
||||
streaming,
|
||||
status,
|
||||
});
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
const response: ResponseInit = {
|
||||
status: args.status,
|
||||
statusText: 'OK',
|
||||
|
|
Loading…
Reference in a new issue