From 367f6b87bc61bddd165d3f612bf95bb8409de9d2 Mon Sep 17 00:00:00 2001 From: Sandesh Gade Date: Wed, 7 Jan 2026 14:12:16 -0500 Subject: [PATCH] update readme + accept modernize suggestion --- README.md | 3 ++- hash.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8195a21..457d487 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![coverage](https://raw.githubusercontent.com/cyberbeast/httpcache/badges/.badges/main/coverage.svg) An HTTP transport for Go standard library's HTTP Client that caches HTTP Responses in a database to speed up subsequent requests. Currently supported: + 1. `sqlite` 2. `postgres` (coming soon) @@ -26,7 +27,7 @@ The implementation currently uses a very basic hashing mechanism to create a sig ## Todo - [x] Basic Cache Invalidation support -- [ ] Add `postgres` as an alternative source +- [x] Add `postgres` as an alternative source - [ ] Improve test coverage - [ ] Add `pgxpool` support for `postgres` source - [ ] Custom caching strategy based on HTTP response status codes diff --git a/hash.go b/hash.go index a80e9c1..e77e31d 100644 --- a/hash.go +++ b/hash.go @@ -33,7 +33,7 @@ func hash(headers http.Header) string { var sb strings.Builder for _, key := range keys { - sb.WriteString(fmt.Sprintf("%s:%s%s", key, headers.Get(key), delimiter)) + fmt.Fprintf(&sb, "%s:%s%s", key, headers.Get(key), delimiter) } return sha256str([]byte(sb.String()))