Files
gf/.example/net/ghttp/client/cookie/client.go

19 lines
303 B
Go
Raw Normal View History

package main
import (
2019-04-03 00:03:46 +08:00
"fmt"
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/os/glog"
)
func main() {
2019-04-03 00:03:46 +08:00
c := ghttp.NewClient()
c.SetHeader("Cookie", "name=john; score=100")
if r, e := c.Get("http://127.0.0.1:8199/"); e != nil {
glog.Error(e)
} else {
fmt.Println(string(r.ReadAll()))
}
}