Skip to content

Go

# Go

Including Status code 1

1
2
3
4
5
6
7
fmt.Printf("RESPONSE:\n")
fmt.Println(resp.Status)
for k, v := range resp.Header {
  fmt.Print(k)
  fmt.Print(" : ")
  fmt.Println(v)
}

Includes Headers and Body in a well formatted way 2 * Request * "Use httputil.DumpRequest() if you want to pretty-print the request on the server side." * "Use httputil.DumpRequestOut() if you want to dump the request on the client side."

1
2
3
4
5
6
    reqDump, err := httputil.DumpRequestOut(req, true)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("REQUEST:\n%s", string(reqDump))

  • Response
    1
    2
    3
    4
    5
    6
        respDump, err := httputil.DumpResponse(resp, true)
        if err != nil {
            log.Fatal(err)
        }
    
        fmt.Printf("RESPONSE:\n%s", string(respDump))
    

Last update: November 15, 2022