I'm trying to view the contents of a cookieJar response from a request to google:
package main
import (
"fmt"
"log"
"net/http"
"net/http/cookiejar"
"net/url"
)
func main() {
jar, err := cookiejar.New(nil)
if err != nil {
log.Fatal(err)
}
client := http.Client{Jar: jar}
resp, err := client.Get("https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Ffeature%3Dsign_in_button%26hl%3Den%26action_handle_signin%3Dtrue%26next%3D%252F%26app%3Ddesktop&service=youtube&sacu=1&passive=1209600&ignoreShadow=0&acui=0#identifier")
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Cookies())
s := ".google.com"
u, err := url.Parse(s)
fmt.Println(client.Jar.Cookies(u))
}
The response is a blank array but I can see that there are cookies being set. How do I view the contents of a cookieJar in Golang?