Commit graph

7 commits

Author SHA1 Message Date
fe7e464a62 Add JSONResponder type and tests
- Introduced JSONResponder type in handler.go, combining JSON body parsing with ResponseHelper handling.
- Implemented ServeHTTP for JSONResponder to automatically decode JSON requests and return structured responses.
- Added comprehensive unit tests for JSONResponder in handler_test.go, covering successful responses, invalid JSON, empty bodies, and error propagation.
- Ensured all new tests adhere to existing project conventions and pass linting checks.
2025-07-08 16:41:08 -05:00
5a38283bb0 Add JSONBodyHandler and tests
- Implemented JSONBodyHandler for automatic JSON body parsing.
- Added comprehensive unit tests for JSONBodyHandler covering successful decoding, invalid JSON, empty bodies, and error propagation.
- Refactored handler_test.go to improve test structure and resolve linting issues (funlen, gocritic).
2025-07-08 16:04:28 -05:00
18d987caf7 Minor test improvements 2025-07-08 11:32:06 -05:00
1c16a893d6 Refactor ResponseHelper and add ResponderHandler
- Modified ResponseHelper.Body signature to return an io.Reader and an error.
- Updated ResponseHandler.ServeHTTP to handle errors from ResponseHelper.Body.
- Implemented JSONResponse and JSONResponseWithStatus functions for easier JSON responses.
- Added comprehensive unit tests for JSON response handling, including error scenarios.
- Extended Helper.ResponderHandler with a new test case to ensure proper error handling and response generation.
- Resolved linting issues related to dynamic error definition and function length in tests.
2025-07-08 09:12:53 -05:00
a136616088 Implement Handler and HandlerFunc, add comprehensive tests 2025-07-07 21:39:47 -05:00
aa7dfb532f 🚧 Scaffold basic functionality 2025-07-07 21:37:05 -05:00
f511b9f240 🎉 Initialize go module 2025-07-07 19:50:06 -05:00