@innet/server 1.4.2 → 1.4.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innet/server",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Create server-side application with innet",
5
5
  "main": "index.js",
6
6
  "module": "index.es6.js",
@@ -10,7 +10,7 @@ export declare const redirectStatuses: {
10
10
  };
11
11
  export interface RedirectProps {
12
12
  to: string;
13
- decode?: boolean;
13
+ encode?: boolean;
14
14
  status?: number | keyof typeof redirectStatuses;
15
15
  }
16
16
  export declare function redirect({ props, children }: {
@@ -17,9 +17,9 @@ function getStatus(status) {
17
17
  }
18
18
  function redirect({ props, children }, handler) {
19
19
  const { res } = handler[ACTION];
20
- const { to, status = 301, decode } = props;
20
+ const { to, status = 301, encode } = props;
21
21
  res.writeHead(getStatus(status), {
22
- location: decode ? decodeURI(to) : to,
22
+ location: encode ? encodeURI(to) : to,
23
23
  });
24
24
  return null;
25
25
  }
@@ -22,9 +22,9 @@ function getStatus(status) {
22
22
  function redirect(_a, handler) {
23
23
  var props = _a.props; _a.children;
24
24
  var res = handler[Action.ACTION].res;
25
- var to = props.to, _b = props.status, status = _b === void 0 ? 301 : _b, decode = props.decode;
25
+ var to = props.to, _b = props.status, status = _b === void 0 ? 301 : _b, encode = props.encode;
26
26
  res.writeHead(getStatus(status), {
27
- location: decode ? decodeURI(to) : to,
27
+ location: encode ? encodeURI(to) : to,
28
28
  });
29
29
  return null;
30
30
  }