summaryrefslogtreecommitdiff
path: root/system/api/push.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-08-15 15:43:49 -0600
committerGitHub <noreply@github.com>2017-08-15 15:43:49 -0600
commitc9a6c2ef34d4c290223963d6e836926c6b58eb1b (patch)
tree5344df00833337f3b16e59ef80ffdf2efa5b0a5e /system/api/push.go
parent4818fd1fd68f6c8f1afe0c730cf4bca1861e6589 (diff)
parent9a14fd72fe0c771d45c79069c65ac9a7170dcaf2 (diff)
Merge pull request #184 from ponzu-cms/ponzu-dev
[core] update Omittable, Pushable interfaces and implementations to take res/req pair and hydrate item for caller
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...)