summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
Diffstat (limited to 'output')
-rw-r--r--output/http/http.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/output/http/http.go b/output/http/http.go
index 9caa1b9..3ea603c 100644
--- a/output/http/http.go
+++ b/output/http/http.go
@@ -1,7 +1,8 @@
package http
import (
- "fmt"
+ "bytes"
+ "net/http"
"github.com/Shugyousha/stasher/output"
"github.com/Shugyousha/stasher/registry"
@@ -13,12 +14,17 @@ func init() {
}
type HttpOutput struct {
+ url string
}
-func New(map[string]string) output.Output {
- return &HttpOutput{}
+func New(kv map[string]string) output.Output {
+ url := kv["url"]
+ return &HttpOutput{url: url}
}
func (h *HttpOutput) Output(w *work.Work) {
- fmt.Printf("%s\n", w.Data)
+ _, err := http.Post(h.url, "application/json", bytes.NewReader(w.Data))
+ if err != nil {
+ w.Err = err
+ }
}