Please help me to understand difference, I want to handle certain requests somthing like that
http.Handle("/html", http.HandlerFunc(renderHtml))
and what is the difference in patter “/html” and “/html/”
Please help me to understand difference, I want to handle certain requests somthing like that
http.Handle("/html", http.HandlerFunc(renderHtml))
and what is the difference in patter “/html” and “/html/”
Paths ending with a slash match that subtree. Paths without a slash match that path only.
So /html
matches /html
and things like /html?foo=bar
but not /html/test
.
The pattern /html/
matches /html/
itself and /html/whatever/underneath
. Note that it does not match /html
(without the slash), but that if you haven’t registered a handler for /html
(without the slash) the HTTP implementation will respond with a redirect /html -> /html/
after which the next request will match. This matches the behavior of traditional HTTP servers serving directories.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.