Skip to content

Commit e69fe87

Browse files
committed
Fixed levigross#23 cookies now takes the value of Response.Cookies() https://golang.org/pkg/net/http/#Response.Cookies
Signed-off-by: Levi Gross <[email protected]>
1 parent df5e0fc commit e69fe87

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

base_get_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func TestGetNoOptionsGzip(t *testing.T) {
183183
func TestGetWithCookies(t *testing.T) {
184184
resp, err := Get("http://httpbin.org/cookies",
185185
&RequestOptions{
186-
Cookies: []http.Cookie{
186+
Cookies: []*http.Cookie{
187187
{
188188
Name: "TestCookie",
189189
Value: "Random Value",

example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func Example_proxy() {
6363
func Example_cookies() {
6464
resp, err := grequests.Get("http://httpbin.org/cookies",
6565
&grequests.RequestOptions{
66-
Cookies: []http.Cookie{
66+
Cookies: []*http.Cookie{
6767
{
6868
Name: "TestCookie",
6969
Value: "Random Value",

request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type RequestOptions struct {
7474

7575
// Cookies is an array of `http.Cookie` that allows you to attach
7676
// cookies to your request
77-
Cookies []http.Cookie
77+
Cookies []*http.Cookie
7878

7979
// UseCookieJar will create a custom HTTP client that will
8080
// process and store HTTP cookies when they are sent down
@@ -487,7 +487,7 @@ func addHTTPHeaders(ro *RequestOptions, req *http.Request) {
487487

488488
func addCookies(ro *RequestOptions, req *http.Request) {
489489
for _, c := range ro.Cookies {
490-
req.AddCookie(&c)
490+
req.AddCookie(c)
491491
}
492492
}
493493

0 commit comments

Comments
 (0)