fix: Handle zstd encoding in webpack proxy config (#30034)

This commit is contained in:
Kamil Gabryjelski
2024-08-28 17:17:12 +02:00
committed by GitHub
parent e886cc40fe
commit 75c500c9a5
4 changed files with 117 additions and 10 deletions

View File

@@ -17,6 +17,7 @@
* under the License.
*/
const zlib = require('zlib');
const { ZSTDDecompress } = require('simple-zstd');
const yargs = require('yargs');
// eslint-disable-next-line import/no-extraneous-dependencies
@@ -127,6 +128,8 @@ function processHTML(proxyResponse, response) {
uncompress = zlib.createBrotliDecompress();
} else if (responseEncoding === 'deflate') {
uncompress = zlib.createInflate();
} else if (responseEncoding === 'zstd') {
uncompress = ZSTDDecompress();
}
if (uncompress) {
originalResponse.pipe(uncompress);