diff --git a/internal/gateway/affinity.go b/internal/gateway/affinity.go index 69be6226e..ee53490ae 100644 --- a/internal/gateway/affinity.go +++ b/internal/gateway/affinity.go @@ -817,7 +817,7 @@ func withoutRefused(key, who string, body []byte) ([]byte, bool) { return nil, false } q["input"], _ = json.Marshal(kept) - b, err := json.Marshal(q) + b, err := marshalJSON(q) return b, err == nil } @@ -873,6 +873,6 @@ func withoutKinds(body []byte, kinds ...string) ([]byte, bool) { return nil, false } q["input"], _ = json.Marshal(kept) - b, err := json.Marshal(q) + b, err := marshalJSON(q) return b, err == nil } diff --git a/internal/gateway/anthropic.go b/internal/gateway/anthropic.go index acfa41a1a..3f346ad5c 100644 --- a/internal/gateway/anthropic.go +++ b/internal/gateway/anthropic.go @@ -372,7 +372,7 @@ func withThinkingOnToolTurns(body []byte) []byte { return body } q["messages"], _ = json.Marshal(msgs) - nb, err := json.Marshal(q) + nb, err := marshalJSON(q) if err != nil { return body } @@ -427,7 +427,7 @@ func withoutThinkingOff(body []byte) ([]byte, bool) { return nil, false } delete(q, "thinking") - out, err := json.Marshal(q) + out, err := marshalJSON(q) return out, err == nil } diff --git a/internal/gateway/codex_backend.go b/internal/gateway/codex_backend.go index dc2463463..facca7118 100644 --- a/internal/gateway/codex_backend.go +++ b/internal/gateway/codex_backend.go @@ -1511,7 +1511,7 @@ func withoutItem(body []byte, id string) ([]byte, bool) { return nil, false } q["input"], _ = json.Marshal(kept) - b, err := json.Marshal(q) + b, err := marshalJSON(q) return b, err == nil } @@ -2822,7 +2822,7 @@ func plainCompact(body []byte) []byte { userMessage(codexCompactPrompt), }) delete(q, "previous_response_id") - nb, err := json.Marshal(q) + nb, err := marshalJSON(q) if err != nil { return body } diff --git a/internal/gateway/limit.go b/internal/gateway/limit.go index 0ec3b3d65..1cf205c6b 100644 --- a/internal/gateway/limit.go +++ b/internal/gateway/limit.go @@ -60,6 +60,6 @@ func withTokenFloor(body []byte, floor int) ([]byte, bool) { if !raised { return nil, false } - b, err := json.Marshal(q) + b, err := marshalJSON(q) return b, err == nil } diff --git a/internal/gateway/responses.go b/internal/gateway/responses.go index c70f7bbba..79343c22e 100644 --- a/internal/gateway/responses.go +++ b/internal/gateway/responses.go @@ -950,7 +950,7 @@ func withReasoningText(body []byte) []byte { continue } m["content"], _ = json.Marshal([]map[string]string{{"type": "reasoning_text", "text": b.String()}}) - if nb, err := json.Marshal(m); err == nil { + if nb, err := marshalJSON(m); err == nil { items[i], changed = nb, true } } @@ -961,8 +961,8 @@ func withReasoningText(body []byte) []byte { if !changed { return body } - q["input"], _ = json.Marshal(items) - nb, err := json.Marshal(q) + q["input"], _ = marshalJSON(items) + nb, err := marshalJSON(q) if err != nil { return body }