Skip to content

Commit

Permalink
[Flight Fixture] Fix proxying with compression (#26368)
Browse files Browse the repository at this point in the history
We're decompressing and then writing and recompressing in the proxy.
This causes it to stall if buffered because `.pipe()` doesn't force
flush automatically.
  • Loading branch information
sebmarkbage committed Mar 11, 2023
1 parent 69fd78f commit 7741118
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fixtures/flight/server/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ app.all('/', async function (req, res, next) {
const rscResponse = await promiseForData;
// For other request, we pass-through the RSC payload.
res.set('Content-type', 'text/x-component');
rscResponse.pipe(res);
rscResponse.on('data', data => {
res.write(data);
res.flush();
});
rscResponse.on('end', data => {
res.end();
});
} catch (e) {
console.error(`Failed to proxy request: ${e.stack}`);
res.statusCode = 500;
Expand Down

0 comments on commit 7741118

Please sign in to comment.