mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:47:07 +00:00
Be more aggressive about what gets compressed
This commit is contained in:
@@ -4,9 +4,11 @@ const compress = compression({
|
|||||||
level: 6, // Balance speed vs. ratio (1-9)
|
level: 6, // Balance speed vs. ratio (1-9)
|
||||||
threshold: 512, // Compress only if response >512 bytes to avoid overhead on small bundles
|
threshold: 512, // Compress only if response >512 bytes to avoid overhead on small bundles
|
||||||
filter: (req, res) => { // Ensure bundles are compressed
|
filter: (req, res) => { // Ensure bundles are compressed
|
||||||
if (req.get("Accept") == "application/vnd.aaltronav.dougal+octet-stream") {
|
const accept = req.get("Accept");
|
||||||
return true;
|
if (accept.startsWith("application/vnd.aaltronav.dougal+octet-stream")) return true;
|
||||||
}
|
if (accept.includes("json")) return true;
|
||||||
|
if (accept.startsWith("text/")) return true;
|
||||||
|
if (accept.startsWith("model/obj")) return true;
|
||||||
|
|
||||||
// fallback to standard filter function
|
// fallback to standard filter function
|
||||||
return compression.filter(req, res)
|
return compression.filter(req, res)
|
||||||
|
|||||||
Reference in New Issue
Block a user