function assessCacheability
Since 0.2.0
assessCacheability(input: CacheabilityInput): readonly CacheRefusal[]

Lists every reason the edge cache would refuse this response.

Exported because it is the one honest way to ask "would the edge cache this?" without attempting a write and catching the rejection.

The 206 and Vary: * checks are unconditional, evaluated independently of cacheableStatuses: an operator can legitimately configure [200, 206], at which point the status check passes and only the explicit 206 rule stops the platform from throwing.

Examples

Example 1

const refusals = assessCacheability({
  method: 'GET',
  status: 200,
  headers: new Headers({ 'set-cookie': 'a=1' }),
  cacheableStatuses: [200],
});
// → ['set-cookie']

Parameters

The request method, response status, headers, and the caller's cacheable-status set

Return Type

readonly CacheRefusal[]

Every refusal that applies; empty when the response is cacheable

Usage

import { assessCacheability } from "cloudflare-plugin/src/index.ts";