Commit 6dc4c588 authored by nanahira's avatar nanahira

fix

parent 34673e12
...@@ -10,7 +10,7 @@ import { sortParams } from './utility/sort-params'; ...@@ -10,7 +10,7 @@ import { sortParams } from './utility/sort-params';
import { InjectAragami } from '../index'; import { InjectAragami } from '../index';
import { Aragami, CacheKey } from 'aragami'; import { Aragami, CacheKey } from 'aragami';
import { reflector } from 'aragami/dist/src/metadata'; import { reflector } from 'aragami/dist/src/metadata';
import { tap } from 'rxjs'; import { of, tap } from 'rxjs';
import { HttpAdapterHost } from '@nestjs/core'; import { HttpAdapterHost } from '@nestjs/core';
class RouteCache { class RouteCache {
...@@ -43,7 +43,7 @@ export class AragamiCacheInterceptor implements NestInterceptor { ...@@ -43,7 +43,7 @@ export class AragamiCacheInterceptor implements NestInterceptor {
} }
const cachedValue = await this.aragami.get(RouteCache, key); const cachedValue = await this.aragami.get(RouteCache, key);
if (cachedValue) { if (cachedValue) {
return cachedValue.value; return of(cachedValue.value);
} }
return next return next
.handle() .handle()
...@@ -63,7 +63,10 @@ export class AragamiCacheInterceptor implements NestInterceptor { ...@@ -63,7 +63,10 @@ export class AragamiCacheInterceptor implements NestInterceptor {
if (!isHttpApp) { if (!isHttpApp) {
return; return;
} }
const url = new URL(httpAdapter.getRequestUrl(context), 'http://localhost'); const url = new URL(
httpAdapter.getRequestUrl(context.getArgByIndex(0)),
'http://localhost',
);
return `${url.pathname}?${sortParams(url.searchParams)}`; return `${url.pathname}?${sortParams(url.searchParams)}`;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment