package helps import ( "context" "net/http" "testing" "github.com/router-for-me/CLIProxyAPI/v7/internal/config" "github.com/router-for-me/CLIProxyAPI/v7/internal/logging" ) func TestRecordAPIResponseMetadataStoresHeadersWhenRequestLogDisabled(t *testing.T) { ctx := logging.WithResponseHeadersHolder(context.Background()) headers := http.Header{} headers.Add("X-Upstream-Request-Id", "upstream-req-1") RecordAPIResponseMetadata(ctx, &config.Config{}, http.StatusOK, headers) headers.Set("X-Upstream-Request-Id", "mutated") got := logging.GetResponseHeaders(ctx) if got.Get("X-Upstream-Request-Id") != "upstream-req-1" { t.Fatalf("response header = %q, want %q", got.Get("X-Upstream-Request-Id"), "upstream-req-1") } }