req, err := http.NewRequest("GET", "/path", nil) if err != nil { // handle error } cookie := &http.Cookie{Name: "session", Value: "abc123"} req.AddCookie(cookie)
req, err := http.NewRequest("GET", "/path", nil) if err != nil { // handle error } cookies := []*http.Cookie{ &http.Cookie{Name: "session", Value: "abc123"}, &http.Cookie{Name: "session2", Value: "def456"}, } for _, cookie := range cookies { req.AddCookie(cookie) }In this example, multiple cookies are created using the `http.Cookie` struct and stored in an array. A new HTTP GET request is created using `http.NewRequest()`. Then, a loop is used to add each cookie to the HTTP request using `req.AddCookie()` method. Package Library: `net/http`