• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 18093700360

29 Sep 2025 10:21AM UTC coverage: 88.954% (-0.1%) from 89.081%
18093700360

Pull #2717

github

katspaugh
Include API version in cache ETags
Pull Request #2717: Feat: Add HTTP caching headers based on Redis TTL

3655 of 4527 branches covered (80.74%)

Branch coverage included in aggregate %.

52 of 70 new or added lines in 8 files covered. (74.29%)

1 existing line in 1 file now uncovered.

12524 of 13661 relevant lines covered (91.68%)

531.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.93
/src/datasources/cache/response-cache.service.ts
1
import { Injectable } from '@nestjs/common';
120✔
2
import { ClsService } from 'nestjs-cls';
120✔
3

4
const RESPONSE_CACHE_TTL_KEY = 'response-cache-ttl';
120✔
5

6
@Injectable()
7
export class ResponseCacheService {
120✔
8
  constructor(private readonly cls: ClsService) {}
4✔
9

10
  trackTtl(ttl: number | null | undefined): void {
11
    if (!this.cls.isActive()) {
4✔
12
      return;
4✔
13
    }
14

NEW
15
    if (ttl === null || ttl === undefined) {
×
NEW
16
      return;
×
17
    }
18

NEW
19
    const normalizedTtl = Math.floor(ttl);
×
20

NEW
21
    if (normalizedTtl <= 0) {
×
NEW
22
      return;
×
23
    }
24

NEW
25
    const currentTtl = this.cls.get<number | undefined>(RESPONSE_CACHE_TTL_KEY);
×
26

NEW
27
    if (currentTtl === undefined || normalizedTtl < currentTtl) {
×
NEW
28
      this.cls.set(RESPONSE_CACHE_TTL_KEY, normalizedTtl);
×
29
    }
30
  }
31

32
  getTtl(): number | undefined {
33
    if (!this.cls.isActive()) {
4!
NEW
34
      return undefined;
×
35
    }
36

37
    return this.cls.get<number | undefined>(RESPONSE_CACHE_TTL_KEY);
4✔
38
  }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc