hono 2.7.4 → 2.7.6

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.
@@ -122,6 +122,7 @@ class Context {
122
122
  }
123
123
  set res(_res) {
124
124
  if (this._res) {
125
+ this._res.headers.delete("content-type");
125
126
  this._res.headers.forEach((v, k) => {
126
127
  _res.headers.set(k, v);
127
128
  });
@@ -34,7 +34,7 @@ const serveStatic = (options = { root: "" }) => {
34
34
  }
35
35
  const url = new URL(c.req.url);
36
36
  let path = (0, import_filepath.getFilePath)({
37
- filename: options.path ?? url.pathname,
37
+ filename: options.path ?? decodeURI(url.pathname),
38
38
  root: options.root,
39
39
  defaultDocument: DEFAULT_DOCUMENT
40
40
  });
@@ -33,7 +33,7 @@ const serveStatic = (options = { root: "" }) => {
33
33
  }
34
34
  const url = new URL(c.req.url);
35
35
  const path = (0, import_filepath.getFilePath)({
36
- filename: options.path ?? url.pathname,
36
+ filename: options.path ?? decodeURI(url.pathname),
37
37
  root: options.root,
38
38
  defaultDocument: DEFAULT_DOCUMENT
39
39
  });
@@ -37,6 +37,8 @@ const mimes = {
37
37
  abw: "application/x-abiword",
38
38
  arc: "application/x-freearc",
39
39
  avi: "video/x-msvideo",
40
+ avif: "image/avif",
41
+ av1: "video/av1",
40
42
  azw: "application/vnd.amazon.ebook",
41
43
  bin: "application/octet-stream",
42
44
  bmp: "image/bmp",
@@ -49,8 +51,8 @@ const mimes = {
49
51
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
50
52
  eot: "application/vnd.ms-fontobject",
51
53
  epub: "application/epub+zip",
52
- gz: "application/gzip",
53
54
  gif: "image/gif",
55
+ gz: "application/gzip",
54
56
  htm: "text/html",
55
57
  html: "text/html",
56
58
  ico: "image/x-icon",
@@ -66,6 +68,7 @@ const mimes = {
66
68
  midi: "audio/x-midi",
67
69
  mjs: "text/javascript",
68
70
  mp3: "audio/mpeg",
71
+ mp4: "video/mp4",
69
72
  mpeg: "video/mpeg",
70
73
  mpkg: "application/vnd.apple.installer+xml",
71
74
  odp: "application/vnd.oasis.opendocument.presentation",
@@ -76,12 +79,11 @@ const mimes = {
76
79
  ogx: "application/ogg",
77
80
  opus: "audio/opus",
78
81
  otf: "font/otf",
79
- png: "image/png",
80
82
  pdf: "application/pdf",
81
83
  php: "application/php",
84
+ png: "image/png",
82
85
  ppt: "application/vnd.ms-powerpoint",
83
86
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
84
- rar: "application/vnd.rar",
85
87
  rtf: "application/rtf",
86
88
  sh: "application/x-sh",
87
89
  svg: "image/svg+xml",
@@ -93,9 +95,8 @@ const mimes = {
93
95
  ttf: "font/ttf",
94
96
  txt: "text/plain",
95
97
  vsd: "application/vnd.visio",
96
- wav: "audio/wav",
97
- weba: "audio/webm",
98
98
  webm: "video/webm",
99
+ weba: "audio/webm",
99
100
  webp: "image/webp",
100
101
  woff: "font/woff",
101
102
  woff2: "font/woff2",
@@ -107,7 +108,9 @@ const mimes = {
107
108
  zip: "application/zip",
108
109
  "3gp": "video/3gpp",
109
110
  "3g2": "video/3gpp2",
110
- "7z": "application/x-7z-compressed"
111
+ "7z": "application/x-7z-compressed",
112
+ gltf: "model/gltf+json",
113
+ glb: "model/gltf-binary"
111
114
  };
112
115
  // Annotate the CommonJS export names for ESM import in node:
113
116
  0 && (module.exports = {
package/dist/context.js CHANGED
@@ -100,6 +100,7 @@ var Context = class {
100
100
  }
101
101
  set res(_res) {
102
102
  if (this._res) {
103
+ this._res.headers.delete("content-type");
103
104
  this._res.headers.forEach((v, k) => {
104
105
  _res.headers.set(k, v);
105
106
  });
@@ -12,7 +12,7 @@ var serveStatic = (options = { root: "" }) => {
12
12
  }
13
13
  const url = new URL(c.req.url);
14
14
  let path = getFilePath({
15
- filename: options.path ?? url.pathname,
15
+ filename: options.path ?? decodeURI(url.pathname),
16
16
  root: options.root,
17
17
  defaultDocument: DEFAULT_DOCUMENT
18
18
  });
@@ -11,7 +11,7 @@ var serveStatic = (options = { root: "" }) => {
11
11
  }
12
12
  const url = new URL(c.req.url);
13
13
  const path = getFilePath({
14
- filename: options.path ?? url.pathname,
14
+ filename: options.path ?? decodeURI(url.pathname),
15
15
  root: options.root,
16
16
  defaultDocument: DEFAULT_DOCUMENT
17
17
  });
@@ -15,6 +15,8 @@ var mimes = {
15
15
  abw: "application/x-abiword",
16
16
  arc: "application/x-freearc",
17
17
  avi: "video/x-msvideo",
18
+ avif: "image/avif",
19
+ av1: "video/av1",
18
20
  azw: "application/vnd.amazon.ebook",
19
21
  bin: "application/octet-stream",
20
22
  bmp: "image/bmp",
@@ -27,8 +29,8 @@ var mimes = {
27
29
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
28
30
  eot: "application/vnd.ms-fontobject",
29
31
  epub: "application/epub+zip",
30
- gz: "application/gzip",
31
32
  gif: "image/gif",
33
+ gz: "application/gzip",
32
34
  htm: "text/html",
33
35
  html: "text/html",
34
36
  ico: "image/x-icon",
@@ -44,6 +46,7 @@ var mimes = {
44
46
  midi: "audio/x-midi",
45
47
  mjs: "text/javascript",
46
48
  mp3: "audio/mpeg",
49
+ mp4: "video/mp4",
47
50
  mpeg: "video/mpeg",
48
51
  mpkg: "application/vnd.apple.installer+xml",
49
52
  odp: "application/vnd.oasis.opendocument.presentation",
@@ -54,12 +57,11 @@ var mimes = {
54
57
  ogx: "application/ogg",
55
58
  opus: "audio/opus",
56
59
  otf: "font/otf",
57
- png: "image/png",
58
60
  pdf: "application/pdf",
59
61
  php: "application/php",
62
+ png: "image/png",
60
63
  ppt: "application/vnd.ms-powerpoint",
61
64
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
62
- rar: "application/vnd.rar",
63
65
  rtf: "application/rtf",
64
66
  sh: "application/x-sh",
65
67
  svg: "image/svg+xml",
@@ -71,9 +73,8 @@ var mimes = {
71
73
  ttf: "font/ttf",
72
74
  txt: "text/plain",
73
75
  vsd: "application/vnd.visio",
74
- wav: "audio/wav",
75
- weba: "audio/webm",
76
76
  webm: "video/webm",
77
+ weba: "audio/webm",
77
78
  webp: "image/webp",
78
79
  woff: "font/woff",
79
80
  woff2: "font/woff2",
@@ -85,7 +86,9 @@ var mimes = {
85
86
  zip: "application/zip",
86
87
  "3gp": "video/3gpp",
87
88
  "3g2": "video/3gpp2",
88
- "7z": "application/x-7z-compressed"
89
+ "7z": "application/x-7z-compressed",
90
+ gltf: "model/gltf+json",
91
+ glb: "model/gltf-binary"
89
92
  };
90
93
  export {
91
94
  getMimeType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
4
4
  "description": "Ultrafast web framework for Cloudflare Workers, Deno, and Bun.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",