From 5ce7fad2f26878c4dc7c1e73dcc295f12bd6b7d7 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Thu, 29 Dec 2016 23:34:26 -0800 Subject: adding req as param to push, initially to get URL Path for http.Pusher#Push --- system/api/handlers.go | 2 +- system/api/push.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'system/api') diff --git a/system/api/handlers.go b/system/api/handlers.go index a01f3dc..40a4a1d 100644 --- a/system/api/handlers.go +++ b/system/api/handlers.go @@ -115,7 +115,7 @@ func contentHandler(res http.ResponseWriter, req *http.Request) { return } - defer push(res, pt, post) + defer push(res, req, pt, post) j, err := fmtJSON(json.RawMessage(post)) if err != nil { diff --git a/system/api/push.go b/system/api/push.go index 3378f0c..5db0a53 100644 --- a/system/api/push.go +++ b/system/api/push.go @@ -9,7 +9,7 @@ import ( "github.com/tidwall/gjson" ) -func push(res http.ResponseWriter, pt func() interface{}, data []byte) { +func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, data []byte) { // Push(target string, opts *PushOptions) error if pusher, ok := res.(http.Pusher); ok { if p, ok := pt().(item.Pushable); ok { @@ -23,7 +23,7 @@ func push(res http.ResponseWriter, pt func() interface{}, data []byte) { for i := range values { val := values[i] val.ForEach(func(k, v gjson.Result) bool { - err := pusher.Push(v.String(), nil) + err := pusher.Push(req.URL.Path+v.String(), nil) if err != nil { log.Println("Error during Push of value:", v.String()) } -- cgit v1.2.3