ahmetb / go-httpbin

http://httpbin.org endpoints for your Go tests
https://godoc.org/github.com/ahmetalpbalkan/go-httpbin
Apache License 2.0
124 stars 26 forks source link

Travis CI #16

Open gaul opened 7 years ago

gaul commented 7 years ago

Please enable Travis CI to prevent regressions like the current one in 2af00d7564ba42267de040990a6588f1ca299315:

--- FAIL: TestDeleteCookies (0.00s)
        Error Trace:    handlers_test.go:404
        Error:          "[k3=v3]" does not contain "k1="

FAIL
exit status 1
FAIL    github.com/ahmetalpbalkan/go-httpbin    2.607s
ahmetb commented 7 years ago

It passed the tests as you can see in https://travis-ci.org/ahmetb/go-httpbin/builds/210435220

gaul commented 7 years ago

This test succeeds with go 1.7.5 and fails with 1.8. The test is actually wrong; it sets three cookies, deletes two, then checks to see if all three remain.

ahmetb commented 7 years ago

We don't just check if all 3 exists. We check that 2 are unset (to empty value), 1 is modified but all 3 are present. Since it worked this way with go1.7 just fine, I've reason to believe that either the CookieJar implementation or the http.Client's way of dealing with cookies has changed.

dbenque commented 6 years ago

For a cookie defined like this: http.Cookie{ Name: "k1", Value: "", Path: "/", Expires: time.Unix(0, 0), MaxAge: 0, }

Go 1.7 produce the following string: k1=; Path=/

While Go 1.9 produce the following string: k1=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT

This is due to the following fix https://github.com/golang/go/commit/d86a6ef0c7e8307802c6cd3f623bade3e78a42bf

So now in 1.9 you have a real deletion of the cookie thanks to the expiration time that is correctly set.