close

client := http.Client{}
request, _ := http.NewRequest("Get", "http://localhost:8080/test", nil)
request.Header.Add("Content-Type", "application/json")
dump, _ := httputil.DumpRequestOut(request, true)
log.Println("resp dump: ", string(dump))
resp, err := client.Do(request)
if err == nil {
  dump, _ := httputil.DumpResponse(resp, true)
  log.Println("resp dump: ", string(dump))
}

 

 

http://speakmy.name/2014/07/29/http-request-debugging-in-go/

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JohnDX 的頭像
    JohnDX

    我要回家想一想~

    JohnDX 發表在 痞客邦 留言(0) 人氣()