ds2api / internal /httpapi /openai /responses /test_helpers_test.go
204848
Initial commit: ds2api with HF Spaces support
feccc69
Raw
History Blame Contribute Delete
570 Bytes
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)
}