github.com/gogf/gf@v1.16.9/.example/net/ghttp/client/cookie/client.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/gogf/gf/net/ghttp"
     7  	"github.com/gogf/gf/os/glog"
     8  )
     9  
    10  func main() {
    11  	c := ghttp.NewClient()
    12  	c.SetHeader("Cookie", "name=john; score=100")
    13  	if r, e := c.Get("http://127.0.0.1:8199/"); e != nil {
    14  		glog.Error(e)
    15  	} else {
    16  		fmt.Println(string(r.ReadAll()))
    17  	}
    18  }