docs: correct response.back() signature and behavior#1959
Closed
Bojun-Vvibe wants to merge 1 commit intokoajs:masterfrom
Closed
docs: correct response.back() signature and behavior#1959Bojun-Vvibe wants to merge 1 commit intokoajs:masterfrom
Bojun-Vvibe wants to merge 1 commit intokoajs:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repo: koajs/koa (⭐ 35000)
Type: docs
Files changed: 1
Lines: +11/-2
What
Fixes the
response.back()API doc entry indocs/api/response.md. Theheading previously documented the method as
response.back(url)and called theparameter "url", but the actual implementation in
lib/response.jsaccepts asingle optional
altparameter that is only used as a fallback when theReferrerheader is missing (or points to a different host). The doc isupdated to
response.back([alt]), with a clearer description and a smallexample 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 inlib/response.jsand the migrationguide (
docs/migration-v2-to-v3.md), so the API reference is now consistentwith 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)— usesReferrerwhen same-host, otherwisealt || '/') and the example fromdocs/migration-v2-to-v3.md.Risk
Low — documentation only, no runtime behavior change.