mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[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:
committed by
GitHub
parent
6598984760
commit
720b69a83a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user