Skip to content

*negroni.responseWriterCloseNotifer is not negroni.ResponseWriter: missing method Before goroutine #7

Description

@tablecell
package main
 
import (
	"fmt"
	"net/http"
	"os"

	"github.com/codegangsta/negroni"
	"github.com/goincremental/negroni-sessions"
	"github.com/goincremental/negroni-sessions/cookiestore"
)

func main() {
	n := negroni.Classic()
	mux := http.NewServeMux()
	store := cookiestore.New([]byte("ohhhsooosecret"))
	n.Use(sessions.Sessions("global_session_store", store))
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Hello, %s!", "negroni")
	})
	n.UseHandler(mux)
	port := os.Getenv("PORT")
	if port == "" {
		port = "3300"
	}
	n.Run(":" + port)
}

go run main.go

[negroni] listening on :3300
[negroni] PANIC: interface conversion: *negroni.responseWriterCloseNotifer is not negroni.ResponseWriter: missing method Before
goroutine 7 [running]:
github.com/codegangsta/negroni.(*Recovery).ServeHTTP.func1(0xac1030, 0xc000006090, 0xc00006a050, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/recovery.go:159 +0xdb
panic(0x1044b00, 0xc00003ee70)
/Go/src/runtime/panic.go:965 +0x1c7
github.com/goincremental/negroni-sessions.Sessions.func1(0xac1030, 0xc000006090, 0xc000040500, 0xc00002e3c0)
|/go/pkg/mod/github.com/goincremental/negroni-sessions@v0.0.0-20171223143234-40b49004abee/sessions.go:96 +0x1bf
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc00003ea50, 0xac1030, 0xc000006090, 0xc000040500, 0xc00002e3c0)
|/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x55
github.com/codegangsta/negroni.middleware.ServeHTTP(0x1129cc0, 0xc00003ea50, 0xc000004180, 0xac1030, 0xc000006090, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/negroni.go:38 +0xa3
github.com/codegangsta/negroni.(*Static).ServeHTTP(0xc00003e9c0, 0xac1030, 0xc000006090, 0xc000040500, 0xc00002e360)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/static.go:53 +0x757
github.com/codegangsta/negroni.middleware.ServeHTTP(0x1129300, 0xc00003e9c0, 0xc000004168, 0xac1030, 0xc000006090, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/negroni.go:38 +0xa3
github.com/codegangsta/negroni.(*Logger).ServeHTTP(0xc00003e7e0, 0xac1030, 0xc000006090, 0xc000040500, 0xc00002e340)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/logger.go:62 +0x99
github.com/codegangsta/negroni.middleware.ServeHTTP(0x11292a0, 0xc00003e7e0, 0xc000004150, 0xac1030, 0xc000006090, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/negroni.go:38 +0xa3
github.com/codegangsta/negroni.(*Recovery).ServeHTTP(0xc00006a050, 0xac1030, 0xc000006090, 0xc000040500, 0xc00002e320)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/recovery.go:193 +0x93
github.com/codegangsta/negroni.middleware.ServeHTTP(0x11292e0, 0xc00006a050, 0xc000004138, 0xac1030, 0xc000006090, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/negroni.go:38 +0xa3
github.com/codegangsta/negroni.(*Negroni).ServeHTTP(0xc00003ea20, 0x112f2d0, 0xc0000700e0, 0xc000040500)
|/go/pkg/mod/github.com/codegangsta/negroni@v1.0.0/negroni.go:96 +0xf7
net/http.serverHandler.ServeHTTP(0xc000070000, 0x112f2d0, 0xc0000700e0, 0xc000040500)
/Go/src/net/http/server.go:2887 +0xaa
net/http.(*conn).serve(0xc0000565a0, 0x112fd80, 0xc00003a400)
/Go/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/Go/src/net/http/server.go:3013 +0x3b8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions