Files
ds2api/internal/httpapi/openai/responses/test_helpers_test.go
2026-04-26 06:58:20 +08:00

29 lines
570 B
Go

package responses
import (
"encoding/json"
"testing"
"github.com/go-chi/chi/v5"
"ds2api/internal/httpapi/openai/shared"
)
func asString(v any) string {
return shared.AsString(v)
}
func decodeJSONBody(t *testing.T, body string) map[string]any {
t.Helper()
var out map[string]any
if err := json.Unmarshal([]byte(body), &out); err != nil {
t.Fatalf("decode json failed: %v, body=%s", err, body)
}
return out
}
func RegisterRoutes(r chi.Router, h *Handler) {
r.Post("/v1/responses", h.Responses)
r.Get("/v1/responses/{response_id}", h.GetResponseByID)
}