|
Yasutaka Kawamoto |
at Mar 22, 2013 at 12:27 pm
|
⇧ |
| |
Oh... I see.
I could run in below code.
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/favicon.ico", handlerICon)
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Println("hello")
}
func handlerICon(w http.ResponseWriter, r *http.Request) {}
Thanks!
2013/3/22 nvcnvn <
nvcnvn1@gmail.com>:
func main() {
http.HandleFunc("/favicon.ico", handlerICon)
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
Vào 18:57:21 UTC+7 Thứ sáu, ngày 22 tháng ba năm 2013, kawamoto đã viết:
Thanks All
I got.
I use Google Chrome.
How do you avoid it?
2013/3/22 Scott Lawrence <byt...@gmail.com>:
If you log the request, you'll see your browser is probably also
requesting
/favicon.ico, which is being passed to that same handler.
On Fri, 22 Mar 2013, kawamoto wrote:In the below code, "hello" is called twice when I accessed to
http://localhost:8080. why?
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Println("hello")
}
--
You received this message because you are subscribed to the Google
Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to golang-nuts...@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out. --
Scott Lawrence
go version go1.0.3
Linux baidar 3.8.3-2-ARCH #1 SMP PREEMPT Sun Mar 17 13:04:22 CET 2013
x86_64
GNU/Linux
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.