I read the response quirks on the readme but have so far been unable to get a struct populated using the response.JSON() method.
I'm using the latest version of grequests with Go 1.11. Here is the chunk of code in question:
resp, _ := session.Post(loginapi, ro)
fmt.Println(resp.Bytes())
fmt.Println(resp.String()) // S1
fmt.Println(resp.StatusCode)
var r = new(APIResponse)
fmt.Println(resp.JSON(&r))
fmt.Println(resp.String()) // S2
In this scenario, S1 will print the response string and S2 will be empty. If I remove the resp.JSON() line everything works fine. Even if I try to call resp.JSON() first to populate before any other response method calls, the struct comes back nil.