Ajax call trigger 2 times

I have build a rest server using GO and standard library.

If i test using curl, it works fine, but from a web browser,
(chrome, firefox and IE) it trigger the request 2x.

I am guessing the browser have some kid of timeout
witch triggers a extra call (curl don’t have this so
i can be the reason curl works fine).

I am new to GO and any suggestions where to look,
and test would be very kind.


The first thing I would inspect is the browser’s network trace. I.e, which requests and responses are going on. You might be able to derive from the trace whether the problem is on the browser’s end or at the server side.

(Especially if curl works fine then I would guess it is a browser problem.)

1 Like

Thanks, the Network calls show the problem, it turns out that browser calls extra for favicon.ico,
it is a problem, and i found suggest how to get round it.

This extra GO code prevent it.

// ==> Dummy needed to stop browser to call extra times.
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {


Browsers are sooo… [enter disparaging word here].

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.