Re: [go-nuts] Functions handled twice

151 views
Skip to first unread message

Jan Mercl

unread,
May 17, 2013, 1:22:52 PM5/17/13
to hbel...@gmail.com, golang-nuts

The browser is probably trying to get the favicon.

-j

tomwilde

unread,
May 17, 2013, 1:47:54 PM5/17/13
to golan...@googlegroups.com
This should be FAQ'ed IMHO

Matthew Kane

unread,
May 17, 2013, 2:06:33 PM5/17/13
to hbel...@gmail.com, golang-nuts
Some browsers will prefetch content. For example, with Chrome, as soon
as I paste that address into the address bar, I see a request to
http://localhost:1890/jobs/, and then a second one when I hit 'enter'.

The favicon.ico situation is unrelated; that resource is served by a
different handler.

On Fri, May 17, 2013 at 11:02 AM, <hbel...@gmail.com> wrote:
> Hello Golang-nuts
>
> I'am developping a simple web application using GO like this
>
> http.HandleFunc("/jobs/", handleJobs)
>
> http.Handle("/", http.FileServer(http.Dir("tpldir")))
>
> http.ListenAndServe(":1890", nil)
>
>
> In my handleJobs function I print a simple text.
>
> When I put this url localhost:1890/jobs in my browser, the simple text is
> printed twice!!
>
> Please do you have an idea why ?
> Thanks.
>
>
> --
> 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.
>
>



--
matt kane
twitter: the_real_mkb / nynexrepublic
http://hydrogenproject.com

Martin Angers

unread,
May 17, 2013, 2:50:31 PM5/17/13
to golan...@googlegroups.com
Use curl to isolate the problem (or to check if there is a problem in the first place).

Hraban Luyat

unread,
May 17, 2013, 2:56:04 PM5/17/13
to golan...@googlegroups.com, hbel...@gmail.com
isn't http.handler routing like servermux prefix based? /favicon.ico falls under / handler

Dave Cheney

unread,
May 17, 2013, 3:01:43 PM5/17/13
to Hraban Luyat, golang-nuts, hbel...@gmail.com
That is correct.

Hicham Bellahcene

unread,
May 19, 2013, 7:13:08 PM5/19/13
to golan...@googlegroups.com
Hello
I found the issue.
I'm using bootstrap css template and in my index.html, there is a link to one css file. When I remove it, the function is handled one now.

Thanks
Reply all
Reply to author
Forward
0 new messages