From 7666e4cb98d4679ed510ae9db0d40be4cf1f97eb Mon Sep 17 00:00:00 2001 From: Olakunle Arewa Date: Tue, 21 Nov 2023 18:28:12 +0100 Subject: [PATCH] fix: use faster JSON for responses --- api/response.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/response.go b/api/response.go index 650eb20..8a4a54a 100644 --- a/api/response.go +++ b/api/response.go @@ -2,10 +2,11 @@ package api import ( "bytes" - "encoding/json" + jsonslow "encoding/json" "net/http" "strings" + "github.com/noxecane/anansi/json" "github.com/noxecane/anansi/responses" "github.com/rs/zerolog" ) @@ -47,7 +48,7 @@ func getJSON(log *zerolog.Logger, v interface{}) []byte { log.UpdateContext(func(ctx zerolog.Context) zerolog.Context { buffer := new(bytes.Buffer) - if err := json.Compact(buffer, raw); err != nil { + if err := jsonslow.Compact(buffer, raw); err != nil { panic(err) }