bun-router 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ const file = async (filepath: string): Promise<Response> => {
26
26
  const response = new Response(content, {
27
27
  status: 200,
28
28
  statusText: 'ok',
29
- headers: { 'Content-Type': 'text/html' },
29
+ headers: { 'Content-Type': 'text/html; charset=utf-8' },
30
30
  });
31
31
 
32
32
  return new Promise<Response>((resolve) => {
@@ -35,10 +35,13 @@ const file = async (filepath: string): Promise<Response> => {
35
35
  }
36
36
 
37
37
  const html = async (content: string): Promise<Response> => {
38
- const response = new Response(content, {
38
+ const buff = Buffer.from(content);
39
+ const c = buff.toString('hex');
40
+
41
+ const response = new Response(c, {
39
42
  status: 200,
40
43
  statusText: 'ok',
41
- headers: {'Content-Type': 'text/html'}
44
+ headers: {'Content-Type': 'text/html'},
42
45
  });
43
46
 
44
47
  return new Promise<Response>((resolve) => {
@@ -110,4 +113,4 @@ const router: Router = (port?: number | string, options?: Options) => {
110
113
  }
111
114
  }
112
115
 
113
- export { router, json, file, extractParams }
116
+ export { router, json, file, extractParams, html }
package/package.json CHANGED
@@ -8,5 +8,5 @@
8
8
  "peerDependencies": {
9
9
  "typescript": "^5.0.0"
10
10
  },
11
- "version": "0.2.2"
11
+ "version": "0.2.4"
12
12
  }