h3 0.7.16 → 0.7.17
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/dist/index.cjs +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -154,12 +154,13 @@ function defaultContentType(event, type) {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
function sendRedirect(event, location, code = 302) {
|
|
157
|
+
const encodedLoc = encodeURI(location);
|
|
157
158
|
event.res.statusCode = code;
|
|
158
|
-
event.res.setHeader("Location",
|
|
159
|
+
event.res.setHeader("Location", encodedLoc);
|
|
159
160
|
const html = `<!DOCTYPE html>
|
|
160
161
|
<html>
|
|
161
|
-
<head><meta http-equiv="refresh" content="0; url=${
|
|
162
|
-
<body>Redirecting to <a href=${JSON.stringify(
|
|
162
|
+
<head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head>
|
|
163
|
+
<body>Redirecting to <a href=${JSON.stringify(encodedLoc)}>${encodedLoc}</a></body>
|
|
163
164
|
</html>`;
|
|
164
165
|
return send(event, html, MIMES.html);
|
|
165
166
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -146,12 +146,13 @@ function defaultContentType(event, type) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function sendRedirect(event, location, code = 302) {
|
|
149
|
+
const encodedLoc = encodeURI(location);
|
|
149
150
|
event.res.statusCode = code;
|
|
150
|
-
event.res.setHeader("Location",
|
|
151
|
+
event.res.setHeader("Location", encodedLoc);
|
|
151
152
|
const html = `<!DOCTYPE html>
|
|
152
153
|
<html>
|
|
153
|
-
<head><meta http-equiv="refresh" content="0; url=${
|
|
154
|
-
<body>Redirecting to <a href=${JSON.stringify(
|
|
154
|
+
<head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head>
|
|
155
|
+
<body>Redirecting to <a href=${JSON.stringify(encodedLoc)}>${encodedLoc}</a></body>
|
|
155
156
|
</html>`;
|
|
156
157
|
return send(event, html, MIMES.html);
|
|
157
158
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "h3",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "Tiny JavaScript Server",
|
|
5
5
|
"repository": "unjs/h3",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"unbuild": "latest",
|
|
46
46
|
"vitest": "latest"
|
|
47
47
|
},
|
|
48
|
-
"packageManager": "pnpm@7.9.
|
|
48
|
+
"packageManager": "pnpm@7.9.5",
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "unbuild",
|
|
51
51
|
"dev": "vitest",
|