I wrote a route function, that accept only image request. Look at the following code.
// Add image route paths
func addImage(path string, handler httpImageFunc, name ...string) {
//log.Println("Add image")
if len(name) > 0 {
router.Handle(path, httpImageFunc(handler)).
Methods("GET").
Headers("Accept", "image/*").
Name(name[0])
} else {
router.Handle(path, httpImageFunc(handler)).
Methods("GET").
Headers("Accept", "image/*")
}
}
As you can see, the requests accept only with header ("Accept", "image/*"). But chrome browser send a request with header
Accept:image/webp,/;q=0.8
and firefox with
Accept:image/png,image/;q=0.8,/*;q=0.5
In this case, when firefox and chrome make an image request, it does not go through the router. What do I have to do, that the request would be get through? I am using gorilla mux as router.