summaryrefslogtreecommitdiff
path: root/system/api/push.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-08-15 13:39:00 -0600
committerSteve Manuel <nilslice@gmail.com>2017-08-15 15:14:52 -0600
commit075aba63ff98f6f16383f27895856da1569761c4 (patch)
treedb6ae78b4770ae728d7c5623cb1214d4ef006910 /system/api/push.go
parent4818fd1fd68f6c8f1afe0c730cf4bca1861e6589 (diff)
update Omittable, Pushable, interface to take res, req pair like Hooks, update implementations & hydrate items
Diffstat (limited to 'system/api/push.go')
-rw-r--r--system/api/push.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/system/api/push.go b/system/api/push.go
index 2b68d5b..f7755e5 100644
--- a/system/api/push.go
+++ b/system/api/push.go
@@ -10,12 +10,16 @@ import (
"golang.org/x/net/http2"
)
-func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, data []byte) {
+func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byte) {
// Push(target string, opts *PushOptions) error
if pusher, ok := res.(http.Pusher); ok {
- if p, ok := pt().(item.Pushable); ok {
+ if p, ok := pt.(item.Pushable); ok {
// get fields to pull values from data
- fields := p.Push()
+ fields, err := p.Push(res, req)
+ if err != nil {
+ log.Println("[Pushable] error:", err)
+ return
+ }
// parse values from data to push
values := gjson.GetManyBytes(data, fields...)