func myHandler(rw web.ResponseWriter, req *web.Request) { rw.Header().Set("X-My-Header", "Hello, world!") rw.Write([]byte("Hello, world!")) }
func myHandler(rw web.ResponseWriter, req *web.Request) { ua := req.Header.Get("User-Agent") rw.Write([]byte(fmt.Sprintf("Your user agent is: %s", ua))) }In this example, the server obtains the "User-Agent" header value from the request and uses it to generate the HTTP response. Overall, the go github.com/gocraft/web package is intended for building web applications in Go, and includes many features for handling HTTP requests and responses.