Skip to content

Conversation

@tenkirin
Copy link
Contributor

@tenkirin tenkirin commented Nov 3, 2025

Description

Docs, fix #8321

Added await body.dump(); to explicitly destroy the response body before throwing an error.

  if (statusCode !== 200) {
+    // consuming the response body is mandatory: https://undici.nodejs.org/#/?id=garbage-collection
+    await body.dump();
    throw new Error(`Ollama request failed with status ${statusCode}`);
  }

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@tenkirin tenkirin requested a review from a team as a code owner November 3, 2025 08:10
@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Nov 3, 2025 8:11am

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

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

cc @nodejs/undici

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.72%. Comparing base (5a1d0c8) to head (062165f).
⚠️ Report is 13 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8322      +/-   ##
==========================================
+ Coverage   76.71%   76.72%   +0.01%     
==========================================
  Files         118      118              
  Lines        9805     9805              
  Branches      335      335              
==========================================
+ Hits         7522     7523       +1     
+ Misses       2281     2280       -1     
  Partials        2        2              

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

@avivkeller avivkeller added this pull request to the merge queue Nov 5, 2025
Merged via the queue into nodejs:main with commit 30d6c52 Nov 5, 2025
12 checks passed
@tenkirin tenkirin deleted the docs/correct-example-code branch November 5, 2025 05:05
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.

[Docs] incorrect example code in docs

6 participants