From 1c1a87c57b6407a41b30e0eb9416f03f4b118aac Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 9 May 2018 12:16:36 -0600 Subject: merge contributions (#246) * expanded help to mention need to import addon (#243) * Remove unused extra backtick (#239) * remove import for golang.org/net/x/http2, co-locate error message * update CI code to run --dev if on ponzu-dev branch * CI: ensure we have latest from ponzu-dev branch --- system/api/push.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/api/push.go b/system/api/push.go index f7755e5..0469548 100644 --- a/system/api/push.go +++ b/system/api/push.go @@ -3,13 +3,15 @@ package api import ( "log" "net/http" + "strings" "github.com/ponzu-cms/ponzu/system/item" "github.com/tidwall/gjson" - "golang.org/x/net/http2" ) +const errRecursivePush = "recursive push not allowed" + 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 { @@ -40,7 +42,10 @@ func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byt err := pusher.Push(v.String(), nil) // check for error, "http2: recursive push not allowed" // and return, suppressing a log message - if err != nil && err.Error() == http2.ErrRecursivePush.Error() { + // XXX: errRecursivePush has been co-located to this + // package instead of importing golang.org/x/net/http2 + // to get the error itself. + if err != nil && strings.Contains(err.Error(), errRecursivePush) { return true } if err != nil { -- cgit v1.2.3