[Flight Fixture] Fix proxying with compression (#26368)

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.
This commit is contained in:
Sebastian Markbåge
2023-03-10 19:48:46 -05:00
committed by GitHub
parent 6598984760
commit 720b69a83a
+7 -1
View File
@@ -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;