When a screen fails to load data, I often send the request outside the browser first. It helps me see the status and response clearly before I start changing the interface. This example uses a temporary local server, Node.js, and curl 7.82.0 or newer for --json.
On Windows PowerShell, use curl.exe in place of curl if your shell maps curl to another command. Keep the server in one terminal and run requests in a second terminal.
1. Create a local endpoint
Save this code as server.mjs in a scratch folder and run node server.mjs. It listens only on localhost port 3000, accepts a JSON title, and returns either a created task or a validation error. It does not persist tasks or provide authentication.
import { createServer } from "node:http";
createServer(async (req, res) => {
const reply = (status, value) => {
res.writeHead(status, { "Content-Type": "application/json" });
res.end(JSON.stringify(value));
};
if (req.method !== "POST" || req.url !== "/tasks") {
return reply(404, { error: "Route not found" });
}
try {
let body = "";
for await (const chunk of req) body += chunk;
const data = JSON.parse(body);
if (typeof data?.title !== "string" || !data.title.trim()) {
return reply(422, { error: "Title is required" });
}
reply(201, { id: 1, title: data.title.trim() });
} catch {
reply(400, { error: "Invalid JSON" });
}
}).listen(3000, "127.0.0.1", () => console.log("Listening on port 3000"));2. Send a valid JSON request
Save the JSON below as task.json. Sending a file keeps the example consistent across shells and avoids differences in command-line quote handling.
{ "title": "Review the contact form" }3. Inspect the status and the response body
Run the command below from the folder containing task.json. --json sends the file as JSON and sets the JSON request headers. --include displays response headers along with the body.
Expect status 201, a JSON Content-Type, and a response containing id 1 and your title. A successful connection alone does not prove the endpoint accepted the request; inspect the HTTP status and body.
curl --include --json @task.json http://127.0.0.1:3000/tasks4. Check a failure deliberately
Change task.json to { "title": "" } and run the following request. Expect status 422 and the message "Title is required". --fail-with-body makes curl return a nonzero exit code for HTTP errors while retaining the response body.
An unavailable port is a different failure: no HTTP response is received at all. Keeping these cases distinct helps explain whether the problem is connectivity, request validation, or the client interface.
curl --include --fail-with-body --json @task.json http://127.0.0.1:3000/tasks5. Compare with the application request
Open the app browser Network panel and compare the method, URL, request body, and response with the curl request. If they differ, fix the discrepancy before changing the rendering code.
A request that works in curl can still fail in a browser because browser rules such as CORS are separate from the server response itself. Treat the terminal result as evidence about this request, not proof that every client can use the endpoint. Stop the local server with Ctrl+C when finished.