hey all I am trying to read the Response from http.Request like so:

func (ctr *Controller) Login(c *common.CPContext, req *http.Request, res 
http.ResponseWriter) (int, interface{}) {      defer func() {
                var code = req.Response.StatusCode;  // invalid memory address 
or nil pointer dereference               if code < 400 {
                        user.LoginAttempts = 0
                } else {
                        user.LoginAttempts = user.LoginAttempts + 1
                }
                _, err := user.Update(ctx, db, boil.Infer())
                if err != nil {
                        log.Warningf("could not save/update user model: %v", 
err)
                }       }()}

10:18 <https://gophers.slack.com/archives/C2J635FSA/p1584508722032100>
I am getting that error:

`invalid memory address or nil pointer dereference` - 

does anyone know how to read the Response StatusCode from req.Response?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/53d558ff-c802-4cf7-b5f0-61f83dcef61a%40googlegroups.com.

Reply via email to