Skip to content

docs: correct response.back() signature and behavior#1959

Closed
Bojun-Vvibe wants to merge 1 commit intokoajs:masterfrom
Bojun-Vvibe:agent/koajs_koa-1776708257
Closed

docs: correct response.back() signature and behavior#1959
Bojun-Vvibe wants to merge 1 commit intokoajs:masterfrom
Bojun-Vvibe:agent/koajs_koa-1776708257

Conversation

@Bojun-Vvibe
Copy link
Copy Markdown

Repo: koajs/koa (⭐ 35000)
Type: docs
Files changed: 1
Lines: +11/-2

What

Fixes the response.back() API doc entry in docs/api/response.md. The
heading previously documented the method as response.back(url) and called the
parameter "url", but the actual implementation in lib/response.js accepts a
single optional alt parameter that is only used as a fallback when the
Referrer header is missing (or points to a different host). The doc is
updated to response.back([alt]), with a clearer description and a small
example matching the migration guide.

Why

The previous entry was misleading: readers could reasonably believe the
argument was the redirect target, when it is actually the fallback. This is
the same back([alt]) shape used in lib/response.js and the migration
guide (docs/migration-v2-to-v3.md), so the API reference is now consistent
with the rest of the docs and with the source.

Testing

Docs-only change. Verified the new wording matches the implementation in
lib/response.js (back (alt) — uses Referrer when same-host, otherwise
alt || '/') and the example from docs/migration-v2-to-v3.md.

Risk

Low — documentation only, no runtime behavior change.

@Bojun-Vvibe Bojun-Vvibe closed this by deleting the head repository Apr 21, 2026
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.

1 participant