asmcos / requests

A golang HTTP client library. Salute to python requests.
Other
665 stars 90 forks source link

New fetures #18

Closed WAY29 closed 3 years ago

WAY29 commented 3 years ago

Hello,I just Used your project as a dependency of my project: github.com/WAY29/gfuzz maybe I need more feature such as:

Do you have a follow-up update plan?

asmcos commented 3 years ago
// example 9 test AddCookie
println("Get example9")
req = Requests()
req.Debug = 1

cookie := &http.Cookie{}
cookie.Name = "anewcookie"
cookie.Value = "20180825"
cookie.Path = "/"

req.SetCookie(cookie)

fmt.Println(req.Cookies)
// req.Proxy("http://127.0.0.1:8888")
req.Get("https://www.httpbin.org/cookies/set?freeform=1234")
req.Get("https://www.httpbin.org")
req.Get("https://www.httpbin.org/cookies/set?a=33d")
resp, err = req.Get("https://www.httpbin.org")

if err == nil {
    coo := resp.Cookies()
    // coo is [] *http.Cookies
    println("********cookies*******")
    for _, c := range coo {
        fmt.Println(c.Name, c.Value)
    }
}