Skip to content

docs: fix has() JSDoc example calling get() instead of has()#1984

Closed
greymoth-jp wants to merge 1 commit into
koajs:masterfrom
greymoth-jp:greymoth-jp/docs/fix-has-jsdoc-get-typo
Closed

docs: fix has() JSDoc example calling get() instead of has()#1984
greymoth-jp wants to merge 1 commit into
koajs:masterfrom
greymoth-jp:greymoth-jp/docs/fix-has-jsdoc-get-typo

Conversation

@greymoth-jp

@greymoth-jp greymoth-jp commented Jun 26, 2026

Copy link
Copy Markdown

What

In lib/response.js, the JSDoc for has() contains a second example that mistakenly calls get() instead of has():

//     this.get('content-type');
//     // => true

get(field) returns this.res.getHeader(field) — a header value string, never true. The comment // => true is factually impossible for get(). The intent of the block is to show that has() is case-insensitive, so the call should be this.has('content-type').

Fix

One-line change: this.get('content-type')this.has('content-type') in the has() JSDoc block (line 507).

No logic changes, no new tests needed.

Summary by Sourcery

Documentation:

  • Fix the has() method JSDoc example to call has() instead of get() when demonstrating case-insensitive header lookup.

Summary by CodeRabbit

  • Documentation
    • Corrected an example in the response header-checking docs to show the proper method for verifying whether a header is set.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a7cfd13-df87-462d-8334-1ce3d4076760

📥 Commits

Reviewing files that changed from the base of the PR and between 52d5e8f and 3c8cb4e.

📒 Files selected for processing (1)
  • lib/response.js

📝 Walkthrough

Walkthrough

The has(field) JSDoc example now shows this.has('content-type') instead of this.get('content-type'). No runtime behavior changed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the documentation-only JSDoc fix in has() and matches the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Corrects the JSDoc example for the has() method in lib/response.js so that it demonstrates case-insensitive header checks using has() instead of incorrectly calling get().

File-Level Changes

Change Details Files
Fixes incorrect method usage in the JSDoc example for the has() response method.
  • Replaces this.get('content-type') with this.has('content-type') in the second example of the has() JSDoc block to accurately reflect the method being documented and its boolean return value.
  • Maintains the case-insensitivity demonstration by using a lowercase header name in the corrected has() example.
lib/response.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.90%. Comparing base (52d5e8f) to head (3c8cb4e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1984   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files           9        9           
  Lines        2109     2109           
=======================================
  Hits         2107     2107           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ziiyodullayevv Ziiyodullayevv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good documentation fix. Correcting the has() JSDoc example to actually call has() instead of get() prevents developer confusion.

@greymoth-jp

Copy link
Copy Markdown
Author

Closing this, it's a cosmetic docs-only change and not worth your review time. Thanks.

@greymoth-jp greymoth-jp closed this Jul 4, 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.

2 participants