← Lessons

quiz vs the machine

Gold1350

Networking

The Curl for Debugging

Driving HTTP by hand to inspect requests and responses.

5 min read · core · beat Gold to climb

A Programmable Client

A browser hides what really happens on an HTTP request. The curl tool lets you send a request by hand and see the full exchange, which makes it ideal for debugging web services and APIs.

What It Reveals

Curl exposes details a browser conceals.

  • Verbose mode prints the request and response headers line by line.
  • You can set the method, headers, and body to test an API precisely.
  • A timing breakdown shows where seconds go, from DNS to connect to first byte.

This lets you separate a slow name lookup from a slow connection from a slow server.

Common Investigations

You can confirm a redirect chain, check which status code an endpoint returns, or send a custom header to reproduce a bug. Resolving a host to a specific address lets you bypass a load balancer and hit one backend. Because curl is scriptable, the same request can run in a loop to catch an intermittent failure.

Key idea

Curl drives HTTP by hand so you can see full headers, set the method and body, and read a timing breakdown that separates slow DNS from slow connect from a slow server.

Check yourself

Answer to earn rating on the learn ladder.

1. What does curl verbose mode show that a browser hides?

2. How does a curl timing breakdown help debugging?