kafka/internal/engines/http_mock_test.go
Franz Kafka dc44837219 feat: build Go-based SearXNG-compatible search service
Implement an API-first Go rewrite with local engine adapters, upstream fallback, and Nix-based tooling so searches can run without matching the original UI while preserving response compatibility.

Made-with: Cursor
2026-03-20 20:34:08 +01:00

26 lines
510 B
Go

package engines
import (
"io"
"net/http"
"strings"
)
type roundTripperFunc func(*http.Request) (*http.Response, error)
func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) {
return f(r)
}
func httpResponse(status int, body string, contentType string) *http.Response {
h := make(http.Header)
if contentType != "" {
h.Set("Content-Type", contentType)
}
return &http.Response{
StatusCode: status,
Header: h,
Body: io.NopCloser(strings.NewReader(body)),
}
}