From 3607a0094e5bf505d442801d108a9fe6f1ef2e6f Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 7 Mar 2017 01:43:59 -0800 Subject: checking Error() equality on recursive push err --- system/api/push.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'system/api/push.go') 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 -- cgit v1.2.3