I have this code
func main() {
router := mux.NewRouter()
router.HandleFunc("/", rootHandler)
router.HandleFunc("/xyz/{url}", urlHandler)
http.Handle("/", router)
log.Fatal(http.ListenAndServe(":8080", nil))
}
With this url: http://localhost:8080/xyz/https%3A%2F%2Fabc.no%2FJZ2las1o3Ct
mux will redirect (301) to
http://localhost:8080/xyz/https:/abc.no/JZ2las1o3Ct
If I change %2F%2F
to only one (%2F
) I do not get redirected and the escaped characters stay escaped.
I have found references to router.SkipClean(true)
but it makes no difference in how Mux handles this.
What I want is that the mux variable url
should hold https%3A%2F%2Fabc.no%2FJZ2las1o3Ct