package http import ( "bytes" "net/http" "github.com/Shugyousha/stasher/output" "github.com/Shugyousha/stasher/registry" "github.com/Shugyousha/stasher/work" ) func init() { registry.Outputregistry["http"] = New } type HttpOutput struct { url string } func New(kv map[string]string) output.Output { url := kv["url"] return &HttpOutput{url: url} } func (h *HttpOutput) Output(w *work.Work) error { _, err := http.Post(h.url, "application/json", bytes.NewReader(w.Data)) if err != nil { w.Err = err } return err }