2025-03-17
2306
#javascript
Njong Emy
202250
116
Mar 17, 2025 ⋅ 8 min read

A complete guide to Fetch API in JavaScript

Njong Emy Njong is currently pursuing a bachelor's degree in computer engineering. In her spare time, she enjoys frontend development, open source projects, and movies :)

Recent posts:

10 Node.js 24 features you're probably not using

10 Node.js 24 features you’re probably not using

The Node.js 24 release included significant updates. Explore 10 features you might not be using yet — but absolutely should be.

Emmanuel John
May 22, 2025 ⋅ 8 min read
six CSS animation libraries to bring your project to life in 2025

6 CSS animation libraries to bring your project to life in 2025

Explore six of the best, easiest, most configurable, and convenient CSS animation libraries available in 2025.

Murat Yüksel
May 22, 2025 ⋅ 8 min read
Understanding Next.js Middleware Vulnerability

Understanding Next.js’s middleware vulnerability

A critical auth bypass vulnerability in Next.js lets attackers skip middleware checks by faking the x-middleware-subrequest header.

David Omotayo
May 21, 2025 ⋅ 6 min read
How To Build A Secure File Upload System In Astro

How to build a secure file upload system in Astro

Build a secure file upload system using Astro’s server-side rendering, Cloudinary’s SDKs, and native integration.

Emmanuel John
May 21, 2025 ⋅ 19 min read
View all posts

One Reply to "A complete guide to Fetch API in JavaScript"

  1. Nice basic overview.
    I’m not convinced the streaming example would work as expected when there’s enough data to cause the parse code to be called more than once. 2 reasons: firstly, it looks like the json would be an array of objects so parsing incomplete data would fail (most likely result would abruptly end in the middle of an object definition, but would certainly be missing the array closing ] char). Secondly, even if the parse did somehow succeed, you’re parsing the entirety of result every time and adding all todos. So the second parse would include all the todos from the first parse and add them again.
    I think you’d need to do some text matching to cut ‘todo’ patterns, from result, wrap them in [] and then parse. Or simply parse when the stream is complete.
    Cheers.

Leave a Reply