From 30d6c5235dc76bc9b1c3706176a6293b64077415 Mon Sep 17 00:00:00 2001 From: "N. Bighetti" <60653216+tenkirin@users.noreply.github.com> Date: Wed, 5 Nov 2025 10:55:51 +0900 Subject: [PATCH] =?UTF-8?q?docs(learn):=20correct=20the=20example=20code?= =?UTF-8?q?=20for=20the=20consumption=20of=20response=E2=80=A6=20(#8322)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs(learn): correct the example code for the consumption of response body --- apps/site/pages/en/learn/getting-started/fetch.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/site/pages/en/learn/getting-started/fetch.md b/apps/site/pages/en/learn/getting-started/fetch.md index 26cd99cd51f70..61c0207d0072b 100644 --- a/apps/site/pages/en/learn/getting-started/fetch.md +++ b/apps/site/pages/en/learn/getting-started/fetch.md @@ -104,6 +104,8 @@ async function streamOllamaCompletion(prompt) { // You can read about HTTP status codes here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status // 200 means the request was successful. 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}`); }