All files / src/handlers blocked-paths.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                                1x            
/**
 * `GET /etc/*` and `GET /var/*` — 404 with empty body.
 *
 * Legacy (src/main.ls:56-57):
 *   @get "#BASEPATH/etc/*": -> @response.send 404 ''
 *   @get "#BASEPATH/var/*": -> @response.send 404 ''
 *
 * Oracle recordings `misc/get-etc-foo-404` and `misc/get-var-foo-404`
 * show the legacy response carries `Content-Type: text/html; charset=utf-8`
 * (Express's default for `.send()`). The Phase 4 task description asks
 * for `text/plain; charset=utf-8`, but the oracle is authoritative —
 * we match the recording so the replay test passes. See FINDINGS.md.
 */
 
export interface BlockedPathResponse {
  readonly status: 404;
  readonly body: '';
  readonly headers: {
    readonly 'Content-Type': 'text/html; charset=utf-8';
  };
}
 
/** Returns the canned 404 shape for `/etc/*` and `/var/*`. */
export function buildBlockedPathResponse(): BlockedPathResponse {
  return {
    status: 404,
    body: '',
    headers: { 'Content-Type': 'text/html; charset=utf-8' },
  };
}