Skip to content

F12.16 — Expose Content-Disposition to browsers

State Closed
Parent E12
Iteration Release 3
Start Date 2026-10-04
Closed Date 2026-10-04
Predecessors —
Source Owner request, 2026-09-28

Stories: 1 Closed

Story State Depends on
S12.16.1 — Add Content-Disposition to EXPOSED_HEADERS Closed (2026-10-04) —

A browser lets script read a cross-origin response header only when the response names it in Access-Control-Expose-Headers (Fetch standard, CORS-safelisted response headers). Content-Disposition is not safelisted. rn_forge.web.EXPOSED_HEADERS is the list both stacks' CORS helpers send (CorsPolicy.expose_headers on FastAPI, cors_settings()'s CORS_EXPOSE_HEADERS on Django). It names ETag, Link, Location, Retry-After, Deprecation and Sunset, but not Content-Disposition, which this kit emits on every export and import template (API conventions §17). A cross-origin client therefore downloads the file but has to invent its name.

Context

The trigger fired when a browser client on a different origin could not read the file name of an export or an import template. The client's work does not gate this feature or any release (ADR-0008).

Design

Outcome: shipped in Release 3's rn-forge-web minor version; the adapters read the constant at runtime and needed no change, and the API conventions §16 list the exposed headers. Only headers the kit itself emits belong in the list, so Accept-Patch, sent only on a 415 that a client handles from the status, is not added.

S12.16.1 — Add Content-Disposition to EXPOSED_HEADERS

State: Closed (2026-10-04)

Acceptance:

  • rn_forge.web.EXPOSED_HEADERS (in rn_forge/web/tracing.py) ends with "Content-Disposition", after "Sunset". The order of the existing entries is unchanged.
  • tests/test_tracing.py's assertion on the list includes Content-Disposition.
  • rn_forge.web.conformance.CASES gains cors.export-exposes-content-disposition in the cors area. The case sends GET /conformance/orders with Accept: text/csv and Origin: https://example.com, and expects the following:
    • status 200;
    • Access-Control-Allow-Origin: https://example.com;
    • expect_header_patterns {"Access-Control-Expose-Headers": r"(.+, )?Content-Disposition(, .+)?"}, written as a literal so it does not read back the constant it tests;
    • expect_text id,name\r\n1,widget\r\n.
  • Both drivers pass the new case and the existing cors.exposed-headers-are-comma-joined with no fixture change.
  • The API conventions' §16 lists Content-Disposition among the exposed headers and names the new case. rn-forge-fastapi's wiring guide mentions it with ETag and Link, and the rn-forge-web CHANGELOG.md has an entry.
  • The acceptance block below passes.
set -euo pipefail
grep -q '"Content-Disposition"' packages/rn-forge-web/src/rn_forge/web/tracing.py
grep -q 'cors.export-exposes-content-disposition' packages/rn-forge-web/src/rn_forge/web/conformance/cases.py
grep -q 'Content-Disposition' packages/rn-forge-web/docs/guides/api-conventions.md
grep -q 'Content-Disposition' packages/rn-forge-web/CHANGELOG.md
(cd packages/rn-forge-web && uv run pytest -q tests/test_tracing.py tests/test_conformance.py)
(cd packages/rn-forge-django && uv run pytest -q tests/test_cors.py tests/test_conformance.py)
(cd packages/rn-forge-fastapi && uv run pytest -q tests/test_cors.py tests/test_conformance.py)
(cd packages/rn-forge-web && uv run --group docs mkdocs build --strict -q --site-dir "$(mktemp -d)")