@@ -16,7 +16,6 @@ import (
1616 "github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
1717 "github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
1818 "github.com/supertokens/supertokens-golang/supertokens"
19- "github.com/valyala/fasthttp"
2019)
2120
2221func main () {
@@ -121,25 +120,13 @@ func main() {
121120// wrapper of the original implementation of verify session to match the required function signature
122121func verifySession (options * sessmodels.VerifySessionOptions ) fiber.Handler {
123122 return func (c * fiber.Ctx ) error {
124- return adaptor .HTTPHandlerFunc ( http . HandlerFunc (session .VerifySession (options , func (rw http.ResponseWriter , r * http.Request ) {
123+ err := adaptor .HTTPHandlerFunc (session .VerifySession (options , func (rw http.ResponseWriter , r * http.Request ) {
125124 c .SetUserContext (r .Context ())
126- err := c .Next ()
127- if err != nil {
128- err = supertokens .ErrorHandler (err , r , rw )
129- if err != nil {
130- rw .WriteHeader (500 )
131- _ , _ = rw .Write ([]byte (err .Error ()))
132- }
133- return
134- }
135- c .Response ().Header .VisitAll (func (k , v []byte ) {
136- if string (k ) == fasthttp .HeaderContentType {
137- rw .Header ().Set (string (k ), string (v ))
138- }
139- })
140- rw .WriteHeader (c .Response ().StatusCode ())
141- _ , _ = rw .Write (c .Response ().Body ())
142- })))(c )
125+ }))(c )
126+ if err != nil {
127+ return err
128+ }
129+ return c .Next ()
143130 }
144131}
145132
0 commit comments