aboutsummaryrefslogtreecommitdiff
path: root/internal/api/server.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-26 16:26:38 -0800
committerFuwn <[email protected]>2026-02-26 16:26:38 -0800
commit8b7f7b938aead6ec285c5c9290f9a4305b96521f (patch)
tree3a52bd80d3a0468b3fc96c5b240d02d7b16e8f49 /internal/api/server.go
parentfeat: Apply Iku formatting (diff)
downloadplutia-test-8b7f7b938aead6ec285c5c9290f9a4305b96521f.tar.xz
plutia-test-8b7f7b938aead6ec285c5c9290f9a4305b96521f.zip
style: align codebase with official Go idioms
Diffstat (limited to 'internal/api/server.go')
-rw-r--r--internal/api/server.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/api/server.go b/internal/api/server.go
index 2a3c589..a3ef211 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -6,10 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "net/http"
- "strconv"
- "strings"
- "time"
"github.com/Fuwn/plutia/internal/checkpoint"
"github.com/Fuwn/plutia/internal/config"
"github.com/Fuwn/plutia/internal/ingest"
@@ -17,6 +13,10 @@ import (
"github.com/Fuwn/plutia/internal/storage"
"github.com/Fuwn/plutia/internal/types"
"github.com/Fuwn/plutia/pkg/proof"
+ "net/http"
+ "strconv"
+ "strings"
+ "time"
)
type Server struct {
@@ -772,12 +772,11 @@ func writeJSON(w http.ResponseWriter, code int, v any) {
}
func writeJSONWithContentType(w http.ResponseWriter, code int, contentType string, v any) {
- w.Header().Set("Content-Type", "application/json")
-
- if strings.TrimSpace(contentType) != "" {
- w.Header().Set("Content-Type", contentType)
+ if strings.TrimSpace(contentType) == "" {
+ contentType = "application/json"
}
+ w.Header().Set("Content-Type", contentType)
w.WriteHeader(code)
_ = json.NewEncoder(w).Encode(v)