diff options
author | Steve Manuel <nilslice@gmail.com> | 2018-05-09 12:16:36 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-09 12:16:36 -0600 |
commit | 1c1a87c57b6407a41b30e0eb9416f03f4b118aac (patch) | |
tree | d0ce6a43ae1227c51d856dad381106c0f84b7bcf /system | |
parent | dab54818334b4bccecbe3c322b0d21bf364d165a (diff) |
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
Diffstat (limited to 'system')
-rw-r--r-- | system/api/push.go | 9 |
1 files changed, 7 insertions, 2 deletions
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 { |