package ingestionbench
import (
"embed"
"errors"
"fmt"
"io"
"net/http"
"strings"
)
//go:embed testdata/body.html
var fixtureFiles embed.FS
// OfflineTransport serves synthetic responses only, rejecting every unlisted
// destination. It never delegates to a real network transport.
type OfflineTransport struct{}
func (OfflineTransport) RoundTrip(r *http.Request) (*http.Response, error) {
if r.Method != "GET" || r.URL.Scheme != "https" {
return nil, errors.New("offline_request_rejected")
}
urls := []string{}
root := "caas-body"
switch r.URL.Host {
case "feeds.finance.yahoo.com", "finance.yahoo.com":
urls = []string{"https://finance.yahoo.com/news/bench-complete.html", "https://finance.yahoo.com/news/bench-partial.html", "https://finance.yahoo.com/news/bench-absent.html"}
case "www.cnbc.com":
root = "ArticleBody-articleBody"
urls = []string{"https://www.cnbc.com/2026/01/02/bench-complete.html", "https://www.cnbc.com/2026/01/02/bench-partial.html", "https://www.cnbc.com/2026/01/02/bench-absent.html"}
default:
return nil, errors.New("offline_request_rejected")
}
body := ""
if r.URL.Host == "feeds.finance.yahoo.com" && r.URL.Path == "/rss/2.0/headline" || r.URL.Host == "www.cnbc.com" && r.URL.Path == "/id/10001147/device/rss/rss.html" {
body = "