Network Debugging Lesson

Network debugging means checking the requests a page sends and the responses it receives. The browser Network panel can show URLs, status codes, response bodies, headers, and loading times.

Code Runner Challenge

Network Debugging Lesson

View IPYNB Source
%%js

// CODE_RUNNER: Network Debugging Lesson

async function checkProfileRequest() {
  const response = await fetch("/api/profile");

  console.log("Status:", response.status);
  console.log("OK:", response.ok);

  const data = await response.json();
  console.log(data);
}
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

This is useful when a page expects data but nothing appears. The bug might be a wrong URL, a failed server response, invalid JSON, or code that reads the wrong property.

The logs show whether the request succeeded before the program tries to use the data. This helps narrow down where the problem starts.