@eduzz/miau-client 1.0.3 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduzz/miau-client",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Eduzz Miau Client",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,14 +33,14 @@ const resources1: Resource[] = [
33
33
 
34
34
  const permissions1: Resource[] = [
35
35
  { protocol: 'http', method: 'GET', path: '/v1/resources' },
36
- { protocol: 'http', method: 'GET', path: '/v1/resources/*' },
36
+ { protocol: 'http', method: 'GET', path: '/v1/RESOURCES/*' },
37
37
  { protocol: 'http', method: 'POST', path: '/v1/resources' },
38
38
  { protocol: 'http', method: 'PUT', path: '/v1/resources/*' },
39
39
  { protocol: 'http', method: 'DELETE', path: '/v1/resources/*' }
40
40
  ];
41
41
 
42
42
  test('should access route', () => {
43
- const resource: Resource = { protocol: 'http', method: 'GET', path: '/v1/resources' };
43
+ const resource: Resource = { protocol: 'http', method: 'GET', path: '/v1/RESOURCES' };
44
44
  equal(isResourceAllowed(resource, resources1, permissions1), true);
45
45
  });
46
46
 
package/src/functions.ts CHANGED
@@ -29,7 +29,7 @@ export const isResourceAllowed = (
29
29
  }
30
30
 
31
31
  return permittedResources.some((permission: Resource) => {
32
- const permissionRegex = wildcardToRegex(permission.path);
32
+ const permissionRegex = wildcardToRegex(permission.path.toLocaleLowerCase());
33
33
  return (
34
34
  permission.method.toLowerCase() === resource.method.toLowerCase() &&
35
35
  permissionRegex.test(resource.path.toLowerCase())