@rabstack/rab-api 1.9.1 → 1.10.1

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/index.cjs.js CHANGED
@@ -614,8 +614,9 @@ const controllerHandler = (controller, config)=>{
614
614
  query = await config.validateQuery(req.query);
615
615
  }
616
616
  }
617
- // Check cache before executing handler
618
- if (isCacheEnabled) {
617
+ // Check cache before executing handler (GET only)
618
+ const isGetRequest = req.method === 'GET';
619
+ if (isCacheEnabled && isGetRequest) {
619
620
  const cacheKey = buildCacheKey(req, cacheConfig.strategy);
620
621
  const cached = await cacheAdapter.get(cacheKey);
621
622
  if (cached) {
@@ -635,8 +636,8 @@ const controllerHandler = (controller, config)=>{
635
636
  } : {
636
637
  data: response
637
638
  });
638
- // Cache the response after successful execution
639
- if (isCacheEnabled) {
639
+ // Cache the response after successful execution (GET only)
640
+ if (isCacheEnabled && isGetRequest) {
640
641
  const cacheKey = buildCacheKey(req, cacheConfig.strategy);
641
642
  // Don't await - cache in background
642
643
  cacheAdapter.set(cacheKey, jsonResponse, cacheConfig.ttl).catch(()=>{
package/index.esm.js CHANGED
@@ -612,8 +612,9 @@ const controllerHandler = (controller, config)=>{
612
612
  query = await config.validateQuery(req.query);
613
613
  }
614
614
  }
615
- // Check cache before executing handler
616
- if (isCacheEnabled) {
615
+ // Check cache before executing handler (GET only)
616
+ const isGetRequest = req.method === 'GET';
617
+ if (isCacheEnabled && isGetRequest) {
617
618
  const cacheKey = buildCacheKey(req, cacheConfig.strategy);
618
619
  const cached = await cacheAdapter.get(cacheKey);
619
620
  if (cached) {
@@ -633,8 +634,8 @@ const controllerHandler = (controller, config)=>{
633
634
  } : {
634
635
  data: response
635
636
  });
636
- // Cache the response after successful execution
637
- if (isCacheEnabled) {
637
+ // Cache the response after successful execution (GET only)
638
+ if (isCacheEnabled && isGetRequest) {
638
639
  const cacheKey = buildCacheKey(req, cacheConfig.strategy);
639
640
  // Don't await - cache in background
640
641
  cacheAdapter.set(cacheKey, jsonResponse, cacheConfig.ttl).catch(()=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabstack/rab-api",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "description": "A TypeScript REST API framework built on Express.js with decorator-based routing, dependency injection, and built-in validation",
5
5
  "author": "Softin",
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {},
28
28
  "typings": "./index.esm.d.ts",
29
- "main": "./dist/index.cjs.js",
30
- "module": "./dist/index.esm.js",
29
+ "main": "./index.cjs.js",
30
+ "module": "./index.esm.js",
31
31
  "files": [
32
32
  "index.cjs.d.ts",
33
33
  "index.cjs.js",