@innet/server 1.6.0 → 1.6.1
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
|
@@ -15,11 +15,14 @@ function getStatus(status) {
|
|
|
15
15
|
return status;
|
|
16
16
|
return redirectStatuses[status] || 301;
|
|
17
17
|
}
|
|
18
|
+
function customEncode(url) {
|
|
19
|
+
return encodeURI(url.replaceAll('%20', ' '));
|
|
20
|
+
}
|
|
18
21
|
function redirect({ props, children }, handler) {
|
|
19
22
|
const { res } = handler[ACTION];
|
|
20
23
|
const { to, status = 301, encode } = props;
|
|
21
24
|
res.writeHead(getStatus(status), {
|
|
22
|
-
location: encode ?
|
|
25
|
+
location: encode ? customEncode(to) : to,
|
|
23
26
|
});
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
@@ -19,12 +19,15 @@ function getStatus(status) {
|
|
|
19
19
|
return status;
|
|
20
20
|
return redirectStatuses[status] || 301;
|
|
21
21
|
}
|
|
22
|
+
function customEncode(url) {
|
|
23
|
+
return encodeURI(url.replaceAll('%20', ' '));
|
|
24
|
+
}
|
|
22
25
|
function redirect(_a, handler) {
|
|
23
26
|
var props = _a.props; _a.children;
|
|
24
27
|
var res = handler[Action.ACTION].res;
|
|
25
28
|
var to = props.to, _b = props.status, status = _b === void 0 ? 301 : _b, encode = props.encode;
|
|
26
29
|
res.writeHead(getStatus(status), {
|
|
27
|
-
location: encode ?
|
|
30
|
+
location: encode ? customEncode(to) : to,
|
|
28
31
|
});
|
|
29
32
|
return null;
|
|
30
33
|
}
|