@sdxc/http 2026.10.6 → 2026.10.9

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.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Response builders that pair a body with its matching Content-Type
3
- * header, covering the common content kinds a server returns.
3
+ * header, covering the common content kinds a server returns. A text kind
4
+ * declares `charset=utf-8`, the encoding a string body is always sent in.
4
5
  * @author [Sergio Xalambrí](https://sergiodxa.com)
5
6
  * @copyright Sergio Xalambrí 2026
6
7
  */
package/dist/response.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Response builders that pair a body with its matching Content-Type
3
- * header, covering the common content kinds a server returns.
3
+ * header, covering the common content kinds a server returns. A text kind
4
+ * declares `charset=utf-8`, the encoding a string body is always sent in.
4
5
  * @author [Sergio Xalambrí](https://sergiodxa.com)
5
6
  * @copyright Sergio Xalambrí 2026
6
7
  */
@@ -32,7 +33,7 @@ export function json(body, init) {
32
33
  */
33
34
  export function text(body, init) {
34
35
  let headers = new Headers(init?.headers);
35
- headers.set("Content-Type", ContentType.Text);
36
+ headers.set("Content-Type", `${ContentType.Text}; charset=utf-8`);
36
37
  return new Response(body, { ...init, headers });
37
38
  }
38
39
  /**
@@ -47,7 +48,7 @@ export function text(body, init) {
47
48
  */
48
49
  export function html(body, init) {
49
50
  let headers = new Headers(init?.headers);
50
- headers.set("Content-Type", ContentType.HTML);
51
+ headers.set("Content-Type", `${ContentType.HTML}; charset=utf-8`);
51
52
  return new Response(body, { ...init, headers });
52
53
  }
53
54
  /**
@@ -62,7 +63,7 @@ export function html(body, init) {
62
63
  */
63
64
  export function css(body, init) {
64
65
  let headers = new Headers(init?.headers);
65
- headers.set("Content-Type", ContentType.CSS);
66
+ headers.set("Content-Type", `${ContentType.CSS}; charset=utf-8`);
66
67
  return new Response(body, { ...init, headers });
67
68
  }
68
69
  /**
@@ -77,7 +78,7 @@ export function css(body, init) {
77
78
  */
78
79
  export function javascript(body, init) {
79
80
  let headers = new Headers(init?.headers);
80
- headers.set("Content-Type", ContentType.JavaScript);
81
+ headers.set("Content-Type", `${ContentType.JavaScript}; charset=utf-8`);
81
82
  return new Response(body, { ...init, headers });
82
83
  }
83
84
  /**
@@ -92,7 +93,7 @@ export function javascript(body, init) {
92
93
  */
93
94
  export function xml(body, init) {
94
95
  let headers = new Headers(init?.headers);
95
- headers.set("Content-Type", ContentType.XML);
96
+ headers.set("Content-Type", `${ContentType.XML}; charset=utf-8`);
96
97
  return new Response(body, { ...init, headers });
97
98
  }
98
99
  /**
@@ -124,7 +125,7 @@ export function csv(body, init) {
124
125
  */
125
126
  export function markdown(body, init) {
126
127
  let headers = new Headers(init?.headers);
127
- headers.set("Content-Type", ContentType.Markdown);
128
+ headers.set("Content-Type", `${ContentType.Markdown}; charset=utf-8`);
128
129
  return new Response(body, { ...init, headers });
129
130
  }
130
131
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/http",
3
- "version": "2026.10.6",
3
+ "version": "2026.10.9",
4
4
  "description": "Response builders, content negotiation, and HTTP caching for the Fetch API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,13 +15,13 @@
15
15
  "./middleware/head-requests": "./dist/middleware/head-requests.js"
16
16
  },
17
17
  "dependencies": {
18
- "@sdxc/crypto": "2026.10.6",
18
+ "@sdxc/crypto": "2026.10.9",
19
19
  "@sdxc/duration": "2026.10.6",
20
20
  "@sdxc/location": "2026.10.2",
21
21
  "@sdxc/result": "2026.10.6",
22
22
  "remix": "3.0.0"
23
23
  },
24
- "gitHead": "b1067eb20fc47ec51ff8c4de47d07dc3f9c00466",
24
+ "gitHead": "64fa732ed0a8ca8693a35aeef6345ae5be2534ef",
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },