@rpcbase/server 0.195.0 → 0.196.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.195.0",
3
+ "version": "0.196.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -6,7 +6,15 @@ const glob = require("glob")
6
6
  const async_wrapper = require("../helpers/async_wrapper")
7
7
 
8
8
 
9
- const COMPRESSED_EXTENSIONS = [".css", ".js", ".svg"]
9
+ const COMPRESSED_EXTENSIONS_MAP = {
10
+ ".css": "text/css",
11
+ ".js": "text/javascript",
12
+ ".svg": "image/svg+xml",
13
+ }
14
+
15
+ const COMPRESSED_EXTENSIONS = Object.keys(COMPRESSED_EXTENSIONS_MAP)
16
+
17
+
10
18
 
11
19
  const src_path = path.join(process.cwd(), "./src/")
12
20
  const build_dir = path.join(process.cwd(), "build/")
@@ -38,6 +46,7 @@ const serve_file = (req, res, full_path) => {
38
46
  res.sendFile(`${file_path}.br`, {
39
47
  headers: {
40
48
  "Content-Encoding": "br"
49
+ "Content-Type": COMPRESSED_EXTENSIONS_MAP[extname],
41
50
  }
42
51
  })
43
52
  }
@@ -45,7 +54,8 @@ const serve_file = (req, res, full_path) => {
45
54
  else if (accept_encoding.indexOf("gzip") > -1) {
46
55
  res.sendFile(`${file_path}.gz`, {
47
56
  headers: {
48
- "Content-Encoding": "gzip"
57
+ "Content-Encoding": "gzip",
58
+ "Content-Type": COMPRESSED_EXTENSIONS_MAP[extname],
49
59
  }
50
60
  })
51
61
  }