github txlog/server v1.18.7

11 hours ago

🚀 Release v1.18.7

This release focuses on code quality improvements, resource leak fixes, and comprehensive unit test coverage for critical API endpoints.

🔧 Code Quality

  • Replaced magic numbers with HTTP status constants (http.StatusOK, http.StatusBadRequest, http.StatusInternalServerError) across all API controllers for improved code readability and maintainability
  • Simplified code structure in GET /v1/transactions/ids with early returns instead of nested if-else blocks
  • Optimized GET /v1/items endpoint by replacing Query with QueryRow for single-row transaction lookup, reducing database round-trips

🐛 Bug Fixes

  • Fixed resource leak in GET /v1/items where defer rows.Close() was incorrectly placed after the loop instead of immediately after query success
  • Fixed resource leak in GET /v1/items/ids with same defer rows.Close() positioning issue
  • Fixed resource leak in GET /v1/transactions/ids with same defer rows.Close() positioning issue

✅ Testing

  • Added comprehensive unit tests for GET /v1/version endpoint covering version formats, content-type, and closure behavior
  • Added comprehensive unit tests for GET /v1/items and GET /v1/items/ids endpoints covering validation, empty results, and data retrieval scenarios
  • Added comprehensive unit tests for GET /v1/transactions/ids endpoint covering JSON validation, filtering, and result ordering
  • Added comprehensive unit tests for POST /v1/transactions endpoint covering transaction creation, duplicate handling, and multi-item transactions

🐳 Docker Image

docker pull cr.rda.run/txlog/server:v1.18.7

🔗 Links

Don't miss a new server release

NewReleases is sending notifications on new releases.