make http client into a processor instead of module

This commit is contained in:
Joel Wetzell
2026-03-08 13:03:54 -05:00
parent 7b1fe47039
commit b7b05cbb77
7 changed files with 101 additions and 260 deletions

View File

@@ -0,0 +1,31 @@
package processor_test
import (
"testing"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/processor"
)
func TestHTTPRequestCreateFromRegistry(t *testing.T) {
registration, ok := processor.ProcessorRegistry["http.request.do"]
if !ok {
t.Fatalf("http.request.do processor not registered")
}
processorInstance, err := registration.New(config.ProcessorConfig{
Type: "http.request.do",
Params: map[string]any{
"method": "GET",
"url": "http://example.com",
},
})
if err != nil {
t.Fatalf("failed to create http.request.do processor: %s", err)
}
if processorInstance.Type() != "http.request.do" {
t.Fatalf("http.request.do processor has wrong type: %s", processorInstance.Type())
}
}