@server/next 0.20.19 → 0.20.21
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 +1 -1
- package/src/ServerError.js +3 -1
- package/src/index.js +2 -3
package/package.json
CHANGED
package/src/ServerError.js
CHANGED
|
@@ -4,7 +4,9 @@ export default class ServerError extends Error {
|
|
|
4
4
|
message = message(vars);
|
|
5
5
|
}
|
|
6
6
|
for (let key in vars) {
|
|
7
|
-
|
|
7
|
+
if (typeof message === "string") {
|
|
8
|
+
message = message.replaceAll(`{${key}}`, vars[key]);
|
|
9
|
+
}
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
super(message);
|
package/src/index.js
CHANGED
|
@@ -116,8 +116,7 @@ const extendWithDefaults = (ctx) => {
|
|
|
116
116
|
export default function server(options = {}) {
|
|
117
117
|
// Make it so that the exported one is a prototype of function()
|
|
118
118
|
if (!(this instanceof server)) {
|
|
119
|
-
|
|
120
|
-
return inst.self();
|
|
119
|
+
return new server(options).self();
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
// Skip "forbidden methods" https://fetch.spec.whatwg.org/#concept-method
|
|
@@ -252,7 +251,7 @@ server.prototype.router = function (basePath, router) {
|
|
|
252
251
|
this.handle(method, basePath + path.replace(/^\//, ""), ...callbacks);
|
|
253
252
|
});
|
|
254
253
|
}
|
|
255
|
-
return this;
|
|
254
|
+
return this.self();
|
|
256
255
|
};
|
|
257
256
|
|
|
258
257
|
server.prototype.test = function () {
|