From cf0aec6fa5ba3d328defb34771d2ebce0d45a80b Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Wed, 17 Sep 2014 10:45:44 +0200 Subject: [PATCH] mtredisalize: Implemented the http POST of the tracked changes to configured URL. --- cmd/mtredisalize/changetracker.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/mtredisalize/changetracker.go b/cmd/mtredisalize/changetracker.go index adf5c2c..3b0af4d 100644 --- a/cmd/mtredisalize/changetracker.go +++ b/cmd/mtredisalize/changetracker.go @@ -3,8 +3,11 @@ package main import ( "encoding/json" "log" + "net/http" "sync" + "bytes" + "bitbucket.org/s_l_teichmann/mtredisalize/common" ) @@ -54,8 +57,11 @@ func (ct *ChangeTracker) FlushChanges(url string) (err error) { log.Printf("WARN: encode changes to JSON failed: %s", err) return } - // TODO: implement http POST - _ = encoded + var buf bytes.Buffer + buf.Write(encoded) + if _, err = http.Post(url, "application/json", &buf); err != nil { + log.Printf("WARN: posting changes to %s failed: %s", url, err) + } }() return }