You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
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.
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:
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.