Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an option to disable HTTP streaming #3777

Merged
merged 18 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing dev test to expect response streaming
  • Loading branch information
Tony Sullivan committed Jun 30, 2022
commit dc10d4dd9853361fe60cfb887eb8e774d45c8c56
1 change: 0 additions & 1 deletion packages/astro/src/core/render/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export function createResult(args: CreateResultArgs): SSRResult {
const url = new URL(request.url);
const canonicalURL = createCanonicalURL('.' + pathname, site ?? url.origin, paginated);
const headers = new Headers();
console.log('createResult', args.streaming);
if (args.streaming) {
headers.set('Transfer-Encoding', 'chunked');
} else {
Expand Down
16 changes: 7 additions & 9 deletions packages/astro/test/streaming.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,14 @@ describe('Streaming disabled', () => {
await devServer.stop();
});

it('Body is not chunked', async () => {
it('Body is chunked', async () => {
let res = await fixture.fetch('/');

expect(res.status).to.equal(200);
expect(res.headers.get('content-type')).to.equal('text/html');
expect(res.headers.has('content-length')).to.equal(true);
expect(parseInt(res.headers.get('content-length'))).to.be.greaterThan(0);

let body = await res.text();
expect(body.startsWith('<!DOCTYPE html>')).to.equal(true);
let chunks = [];
for await (const bytes of res.body) {
let chunk = bytes.toString('utf-8');
chunks.push(chunk);
}
expect(chunks.length).to.be.greaterThan(1);
});
});

Expand Down