Golang net/http.ReadResponse() function example
package net/http
Golang net/http.ReadResponse() function usage example
var network string
var address string
conn, err := net.Dial(network, address)
if err != nil {
panic(err)
}
resp, err := http.ReadResponse(bufio.NewReader(conn), &http.Request{Method: "CONNECT"})
if err == nil && resp.Status == connected {
// do something
}
if err == nil {
err = errors.New("unexpected HTTP response: " + resp.Status)
}
conn.Close()
References :
Advertisement
Something interesting
Tutorials
+6.5k Unix/Linux : How to get own IP address ?
+15.9k Golang : Get current time from the Internet time server(ntp) example
+6.8k Swift : substringWithRange() function example
+5.8k Golang : Launching your executable inside a console under Linux
+18.4k Golang : How to remove certain lines from a file
+33.7k Golang : All update packages with go get command
+20.2k Golang : How to get own program name during runtime ?
+10k Golang : Setting variable value with ldflags
+13.1k Golang : List objects in AWS S3 bucket
+5.6k Golang : Shortening import identifier
+9.5k Mac OSX : Get a process/daemon status information
+20.2k Golang : Determine if directory is empty with os.File.Readdir() function