Closed
Description
-
Run a (Go) webserver (on e.g. localhost:8080)
-
Run this as client:
package main
import (
"io"
"log"
"os"
"net/http"
)
func main() {
// works with "http://localhost:8080foobar/valid_path" too
resp, err := http.Get("http://localhost:8080foobar/")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
if _, err := io.Copy(os.Stdout, resp.Body); err != nil {
log.Fatal(err)
}
}
- Notice how the "foobar" string between the port and the url path does not seem to be a problem.
I was expecting to get an error with such an URL.
I did not dig any further to see where that leniency comes from, because maybe that's not an actual concern. Let me know and I can look into it.
go version: go1.6beta2 linux/amd64