diff options
Diffstat (limited to 'filter/http.go')
| -rw-r--r-- | filter/http.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/filter/http.go b/filter/http.go deleted file mode 100644 index 97fffa7..0000000 --- a/filter/http.go +++ /dev/null @@ -1,35 +0,0 @@ -package filter - -import ( - "bytes" - "io/ioutil" - "net/http" - - "github.com/Shugyousha/stasher/work" -) - -type HTTPFilter struct { - url string -} - -func NewHTTPFilter(url string) *HTTPFilter { - return &HTTPFilter{url: url} -} - -func (hf *HTTPFilter) Filter(w *work.Work) *work.Work { - resp, err := http.Post(hf.url, "application/json", bytes.NewReader(w.Data)) - if err != nil { - w.Err = err - return w - } - defer resp.Body.Close() - - filtered, err := ioutil.ReadAll(resp.Body) - if err != nil { - w.Err = err - return w - } - - w.Data = filtered - return w -} |
