Skip to content

fix: honor cache directives for streaming requests - #155

Open
peterpme wants to merge 1 commit into
margelo:mainfrom
peterpme:peter/fix-stream-cache-directives
Open

fix: honor cache directives for streaming requests#155
peterpme wants to merge 1 commit into
margelo:mainfrom
peterpme:peter/fix-stream-cache-directives

Conversation

@peterpme

Copy link
Copy Markdown
Contributor

Summary

  • reuse the existing RequestInit.cache header mapping for standard and streaming fetches
  • add harness coverage for cache: "no-store" with stream: true

Why

The standard path sends Cache-Control: no-store, but the streaming path silently ignored the same option. On iOS, streaming uses a disk-backed URLCache, so authenticated streamed responses could remain eligible for persistence despite the caller explicitly requesting no-store.

This keeps the existing cache enabled for default requests; it only honors the caller-selected directive.

Closes #154

Validation

  • bun lint (passes with two existing no-shadow warnings)
  • bun typecheck
  • bun test --maxWorkers=2
  • pre-commit lint and type hooks

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@peterpme is attempting to deploy a commit to the Margelo Team on Vercel.

A member of the Team first needs to authorize it.

@riteshshukla04

Copy link
Copy Markdown
Collaborator

The tests seems to be failing . Lets fix that

function applyCacheHeaders(
headers: NitroHeader[],
cache: RequestCache | undefined
): void {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add. worklets

headers.push({ key: 'Cache-Control', value: 'no-cache' });
headers.push({ key: 'Pragma', value: 'no-cache' });
}
applyCacheHeaders(headers, cacheOption);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can also wire buildNitroRequestPure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: honor cache directives for streaming requests

2 participants