{"action":"created","issue":{"url":"https://api.github.com/repos/pressly/cji/issues/2","labels_url":"https://api.github.com/repos/pressly/cji/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/pressly/cji/issues/2/comments","events_url":"https://api.github.com/repos/pressly/cji/issues/2/events","html_url":"https://github.com/pressly/cji/issues/2","id":60578059,"number":2,"title":"Problem with certain middlewares","user":{"login":"patrickdappollonio","id":930925,"avatar_url":"https://avatars.githubusercontent.com/u/930925?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickdappollonio","html_url":"https://github.com/patrickdappollonio","followers_url":"https://api.github.com/users/patrickdappollonio/followers","following_url":"https://api.github.com/users/patrickdappollonio/following{/other_user}","gists_url":"https://api.github.com/users/patrickdappollonio/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickdappollonio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickdappollonio/subscriptions","organizations_url":"https://api.github.com/users/patrickdappollonio/orgs","repos_url":"https://api.github.com/users/patrickdappollonio/repos","events_url":"https://api.github.com/users/patrickdappollonio/events{/privacy}","received_events_url":"https://api.github.com/users/patrickdappollonio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-10T22:11:22Z","updated_at":"2015-03-18T17:18:31Z","closed_at":null,"body":"Hello,\r\n\r\nI was trying to use an authentication middleware in my project together with Cji (which I have to say, make everything less painful regarding chaining middlewares on Goji projects) but I cannot seem to get it working...\r\n\r\nThe middleware I was trying to use was [httpauth](https://github.com/goji/httpauth) from Goji itself. From what I can see, the problem is at this line `fn = mw(http.HandlerFunc(newFn)).(http.HandlerFunc)` where Cji assumes that the function could be asserted as an `http.HandlerFunc`.\r\n\r\nHere's how I declared the route:\r\n\r\n```go\r\ngoji.Get(\"/panel/categories\", cji.Use(boltHandler, httpauth.SimpleBasicAuth(\"test\", \"pass\")).On(handler))\r\n```\r\n\r\nAny ideas?\r\n\r\n```\r\n2015/03/10 18:59:35.862987 [COMPUTER/47zK9KnkTB-000012] Returning 304 in 1ms\r\n2015/03/10 18:59:42.655350 [COMPUTER/47zK9KnkTB-000013] Started GET \"/panel/categories\" from 127.0.0.1:54665\r\n2015/03/10 18:59:42.689350 [COMPUTER/47zK9KnkTB-000013] panic: interface conversion: http.Handler is httpauth.basicAuth, not http.HandlerFunc\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware/recoverer.go:24 (0x5075b3)\r\n        func.005: debug.PrintStack()\r\nc:/go/src/runtime/asm_amd64.s:401 (0x42702c)\r\n        call16: CALLFN(·call16, 16)\r\nc:/go/src/runtime/panic.go:387 (0x4138cf)\r\n        gopanic: reflectcall(unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz),uint32(d.siz))\r\nc:/go/src/runtime/iface.go:181 (0x40bf32)\r\n        assertI2T: panic(&TypeAssertionError{*tab.inter.typ._string, *tab._type._string, *t._string, \"\"})\r\nC:/Users/TestUser/Go/src/github.com/pressly/cji.go:80 (0x4487f9)\r\n        func.003: fn = mw(http.HandlerFunc(newFn)).(http.HandlerFunc)\r\nC:/Users/TestUser/Go/src/github.com/pressly/cji.go:72 (0x44861a)\r\n        func.002: hf(c, ww, rr)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/test/project/middleware/boltdb/boltdb.go:15 (0x448ee7)\r\n        func.001: h.ServeHTTP(w, r)\r\nC:/Users/TestUser/Go/src/github.com/pressly/cji.go:84 (0x44882c)\r\n        func.003: fn(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/web.go:113 (0x48acbc)\r\n        HandlerFunc.ServeHTTPC: h(c, w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/router.go:114 (0x488eeb)\r\n        (*router).route: route.handler.ServeHTTPC(*c, w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware.go:88 (0x48ada7)\r\n        func.002: router.route(&cs.C, w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/test/project/middleware/renderer/renderer.go:16 (0x449630)\r\n        func.001: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/test/project/middleware/static/static.go:33 (0x449ac8)\r\n        func.001: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/test/project/middleware/promote/promote.go:15 (0x4492a3)\r\n        func.001: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware/options.go:70 (0x5074c5)\r\n        func.003: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware/recoverer.go:29 (0x507725)\r\n        func.006: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware/logger.go:35 (0x507269)\r\n        func.001: h.ServeHTTP(lw, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware/request_id.go:68 (0x507a4c)\r\n        func.007: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1265 (0x462098)\r\n        HandlerFunc.ServeHTTP: f(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/middleware.go:46 (0x4857a9)\r\n        (*cStack).ServeHTTP: s.m.ServeHTTP(w, r)\r\nC:/Users/TestUser/Go/src/github.com/zenazn/goji/web/mux.go:65 (0x486c57)\r\n        (*Mux).ServeHTTP: stack.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1541 (0x463834)\r\n        (*ServeMux).ServeHTTP: h.ServeHTTP(w, r)\r\nc:/go/src/net/http/server.go:1703 (0x4641c1)\r\n        serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)\r\nc:/go/src/net/http/server.go:1204 (0x461bce)\r\n        (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)\r\nc:/go/src/runtime/asm_amd64.s:2232 (0x4291a1)\r\n        goexit:\r\n2015/03/10 18:59:42.722351 [COMPUTER/47zK9KnkTB-000013] Returning 500 in 67.0\r\n013ms\r\n```"},"comment":{"url":"https://api.github.com/repos/pressly/cji/issues/comments/83065095","html_url":"https://github.com/pressly/cji/issues/2#issuecomment-83065095","issue_url":"https://api.github.com/repos/pressly/cji/issues/2","id":83065095,"user":{"login":"pkieltyka","id":18831,"avatar_url":"https://avatars.githubusercontent.com/u/18831?v=3","gravatar_id":"","url":"https://api.github.com/users/pkieltyka","html_url":"https://github.com/pkieltyka","followers_url":"https://api.github.com/users/pkieltyka/followers","following_url":"https://api.github.com/users/pkieltyka/following{/other_user}","gists_url":"https://api.github.com/users/pkieltyka/gists{/gist_id}","starred_url":"https://api.github.com/users/pkieltyka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkieltyka/subscriptions","organizations_url":"https://api.github.com/users/pkieltyka/orgs","repos_url":"https://api.github.com/users/pkieltyka/repos","events_url":"https://api.github.com/users/pkieltyka/events{/privacy}","received_events_url":"https://api.github.com/users/pkieltyka/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T17:18:31Z","updated_at":"2015-03-18T17:18:31Z","body":"fixed in 51b0fbb7a97f15d996e20f6e7a44c51abf5f4194 - thanks all!"}}