@furystack/rest-service
Advanced tools
Comparing version 6.2.2 to 6.2.3
@@ -39,4 +39,4 @@ "use strict"; | ||
Object.entries(api[method]).forEach(([path, action]) => { | ||
const fullPath = `/${utils_1.PathHelper.joinPaths(root, path)}`; | ||
const regex = (0, path_to_regexp_1.pathToRegexp)(fullPath); | ||
const fullPath = `/${utils_1.PathHelper.normalize(utils_1.PathHelper.joinPaths(root, path))}`; | ||
const regex = (0, path_to_regexp_1.pathToRegexp)(fullPath, undefined, { endsWith: '/' }); | ||
endpoint[path] = { regex, action, fullPath }; | ||
@@ -43,0 +43,0 @@ }); |
@@ -19,3 +19,3 @@ "use strict"; | ||
POST: { | ||
'/:id': (0, create_post_endpoint_1.createPostEndpoint)({ model: utils_2.MockClass, primaryKey: 'id' }), | ||
'/': (0, create_post_endpoint_1.createPostEndpoint)({ model: utils_2.MockClass, primaryKey: 'id' }), | ||
}, | ||
@@ -25,3 +25,3 @@ }, | ||
const entityToPost = { id: 'mock', value: 'posted' }; | ||
const response = await fetch('http://127.0.0.1:1117/api/mock', { | ||
const response = await fetch('http://127.0.0.1:1117/api', { | ||
method: 'POST', | ||
@@ -28,0 +28,0 @@ body: JSON.stringify(entityToPost), |
{ | ||
"name": "@furystack/rest-service", | ||
"version": "6.2.2", | ||
"version": "6.2.3", | ||
"description": "Repository implementation for FuryStack", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -71,4 +71,4 @@ import type { Disposable } from '@furystack/utils' | ||
Object.entries((api as any)[method]).forEach(([path, action]) => { | ||
const fullPath = `/${PathHelper.joinPaths(root, path)}` | ||
const regex = pathToRegexp(fullPath) | ||
const fullPath = `/${PathHelper.normalize(PathHelper.joinPaths(root, path))}` | ||
const regex = pathToRegexp(fullPath, undefined, { endsWith: '/' }) | ||
;(endpoint as any)[path] = { regex, action, fullPath } | ||
@@ -75,0 +75,0 @@ }) |
@@ -13,3 +13,3 @@ import { usingAsync } from '@furystack/utils' | ||
setupContext(i) | ||
await useRestService<{ POST: { '/:id': PostEndpoint<MockClass, 'id'> } }>({ | ||
await useRestService<{ POST: { '/': PostEndpoint<MockClass, 'id'> } }>({ | ||
injector: i, | ||
@@ -20,3 +20,3 @@ root: '/api', | ||
POST: { | ||
'/:id': createPostEndpoint({ model: MockClass, primaryKey: 'id' }), | ||
'/': createPostEndpoint({ model: MockClass, primaryKey: 'id' }), | ||
}, | ||
@@ -26,3 +26,3 @@ }, | ||
const entityToPost = { id: 'mock', value: 'posted' } | ||
const response = await fetch('http://127.0.0.1:1117/api/mock', { | ||
const response = await fetch('http://127.0.0.1:1117/api', { | ||
method: 'POST', | ||
@@ -29,0 +29,0 @@ body: JSON.stringify(entityToPost), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
563656