summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-03-07 01:43:59 -0800
committerSteve Manuel <nilslice@gmail.com>2017-03-07 01:43:59 -0800
commit3607a0094e5bf505d442801d108a9fe6f1ef2e6f (patch)
tree6eb0eded39a1ac0091be1bc3dec64902603e8e4f
parentc8bd692a44795f9354acb4583dc35ec3a2604096 (diff)
checking Error() equality on recursive push err
-rw-r--r--system/api/push.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/system/api/push.go b/system/api/push.go
index a6402bc..e936ef7 100644
--- a/system/api/push.go
+++ b/system/api/push.go
@@ -28,9 +28,19 @@ func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, dat
return true
}
+ // check that the push is not to its parent URL
+ if v.String() == (req.URL.Path + "?" + req.URL.RawQuery) {
+ return true
+ }
+
err := pusher.Push(v.String(), nil)
- if err != nil && err != http2.ErrRecursivePush {
- log.Println("Error during Push of value:", v.String())
+ // check for error, "http2: recursive push not allowed"
+ // and return, supressing a log message
+ if err != nil && err.Error() == http2.ErrRecursivePush.Error() {
+ return true
+ }
+ if err != nil {
+ log.Println("Error during Push of value:", v.String(), err)
}
return true