Go HTTP utilities for microservices with integrated logging, tracing, and error handling used in StreamingFast products.
- Request handling: Extract and validate URL parameters, query strings, and JSON payloads
- Response writing: JSON, text, HTML, and raw responses with proper headers and error logging
- Error handling: Structured HTTP error responses with tracing support
- Handler wrappers: Simplified handler patterns for common use cases
- Utilities: Real IP detection, response forwarding
JSONHandler- Wrap functions that return JSON responsesRawHandler- Stream raw content from io.ReadCloserDirectHandler- Direct response writer control with error handling
ExtractRequest- Extract URL/query parameters into structsExtractJSONRequest- Parse and validate JSON request bodies
WriteJSON- Write JSON responsesWriteError- Write structured error responsesWriteText,WriteHTML- Write text/HTML responses
- HTTP status error constructors:
BadRequestError,NotFoundError,InternalServerError, etc.
See full documentation for complete API reference.