From 905a35c42018a6f8df4690ef5ebdf7e3c0efa63b Mon Sep 17 00:00:00 2001 From: kulesy Date: Mon, 7 Sep 2026 15:13:03 +1000 Subject: [PATCH] Treat zstd as a binary content-encoding in the AWS and Azure providers Co-Authored-By: Claude Opus 5 --- lib/provider/aws/is-binary.js | 2 +- lib/provider/azure/is-binary.js | 2 +- test/is-binary.js | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/provider/aws/is-binary.js b/lib/provider/aws/is-binary.js index 59a3cdf..c3a2601 100644 --- a/lib/provider/aws/is-binary.js +++ b/lib/provider/aws/is-binary.js @@ -1,6 +1,6 @@ 'use strict'; -const BINARY_ENCODINGS = ['gzip', 'deflate', 'br']; +const BINARY_ENCODINGS = ['gzip', 'deflate', 'br', 'zstd']; const BINARY_CONTENT_TYPES = (process.env.BINARY_CONTENT_TYPES || '').split(','); function isBinaryEncoding(headers) { diff --git a/lib/provider/azure/is-binary.js b/lib/provider/azure/is-binary.js index 59a3cdf..c3a2601 100644 --- a/lib/provider/azure/is-binary.js +++ b/lib/provider/azure/is-binary.js @@ -1,6 +1,6 @@ 'use strict'; -const BINARY_ENCODINGS = ['gzip', 'deflate', 'br']; +const BINARY_ENCODINGS = ['gzip', 'deflate', 'br', 'zstd']; const BINARY_CONTENT_TYPES = (process.env.BINARY_CONTENT_TYPES || '').split(','); function isBinaryEncoding(headers) { diff --git a/test/is-binary.js b/test/is-binary.js index d666c61..3a1f434 100644 --- a/test/is-binary.js +++ b/test/is-binary.js @@ -6,6 +6,18 @@ const sinon = require('sinon'); describe('is-binary', function() { + it('handles content-encoding', function() { + const result = isBinary({ ['content-encoding']: 'gzip' }, {}); + + expect(result).to.be.true; + }); + + it('handles zstd content-encoding', function() { + const result = isBinary({ ['content-encoding']: 'zstd' }, {}); + + expect(result).to.be.true; + }); + it('handles charset', function() { const result = isBinary({ ['content-type']: 'application/json; charset:utf-8' }, { binary: ['application/json']