httptest provides Go testing utilities for isolating HTTP handlers, capturing responses, and creating temporary test servers. It makes request methods, bodies, status codes, and response data directly testable. section 8.6
Testing GET and POST handlers
A GET handler returns "hello" with status 200. A POST handler reads the request body, returns status 201, and prefixes it with "hello ". A table test checks both cases and can also cover invalid methods through a route.



