yedra 0.11.2 → 0.11.4

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.
@@ -15,7 +15,10 @@ export class Path {
15
15
  if (!path.startsWith('/')) {
16
16
  throw new Error(`API path ${path} is invalid: Must start with '/'.`);
17
17
  }
18
- this.expected = path.substring(1).split('/');
18
+ this.expected = path
19
+ .substring(1)
20
+ .split('/')
21
+ .filter((segment) => segment !== '');
19
22
  const invalidSegment = this.expected.find((part) => part.match(/^((:?[a-z0-9-]+\??)|\*)$/) === null);
20
23
  if (invalidSegment) {
21
24
  throw new Error(`API path ${path} is invalid: Segment ${invalidSegment} does not match regex /^((:?[a-z0-9-]+\\??)|\\*)$/.`);
@@ -11,7 +11,7 @@ class RestEndpoint {
11
11
  this.headersSchema = object(options.headers);
12
12
  }
13
13
  get method() {
14
- return this.method;
14
+ return this._method;
15
15
  }
16
16
  async handle(req, params, _server) {
17
17
  let parsedBody;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yedra",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "repository": "github:0codekit/yedra",
5
5
  "main": "dist/index.js",
6
6
  "devDependencies": {