We break down how to unit-test HTTP handlers in Go without starting a server: call
ServeHTTP manually, create a request via
httptest.NewRequest, and capture the response with
httptest.NewRecorder. We learn to verify the
status, the
Content-Type header, the JSON contract via decoding, the error envelope for
validation/
not_found/
internal, and we also write helpers with
t.Helper() and table-driven tests.