package httpapi

import (
	"net/http/httptest"
	"testing"

	"github.com/easyai/easyai-ai-gateway/apps/api/internal/clients"
)

func TestApplyRunErrorHeadersUsesRouteRetryAfter(t *testing.T) {
	recorder := httptest.NewRecorder()
	applyRunErrorHeaders(recorder, &clients.ClientError{
		Code: "upstream_route_unavailable", Details: map[string]any{"retryAfterSeconds": 10},
	})
	if got := recorder.Header().Get("Retry-After"); got != "10" {
		t.Fatalf("Retry-After=%q, want 10", got)
	}
}
