kornelski / kornelski/http-cache-semantics

Expose status code from policy object?

Open
#51 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
260
Forks
34
PR merge metrics
No merged PRs in 30d

Description

In one of my project where I get to implement a cache, I store the response body (content) and the policy (via `.toObject()`) together. When assembling a response from cache, I have access to the body and the header through the policy object, but not the status code. Since it is already stored in the policy, would it be good to also expose it (e.g. directly with a new `.statusCode()` API, or from `evaluateRequest()` or `revalidatedPolicy()`)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the policy object returned by .toObject(), then compare the information exposed by evaluateRequest() and revalidatedPolicy(). Decide where a cached response's status code should be exposed and define the expected API behavior. Done means callers can recover the status code alongside the cached body and headers, with coverage for the chosen API.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.