I'm Sorry in advance for the probably stupid question. I want to send an image(image/jpeg) when certain URL is called. When I do few get request everything seems to be working fine, but when I use apache benchmark to stress test the same endpoint I got this error
write tcp [::1]:8080->[::1]:65255: write: broken pipe
Here is a code I want to execute:
func CameraImage(w http.ResponseWriter, r *http.Request) {
//log.Println("Serving", r.URL)
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Content-Type", "image/jpeg")
vars := mux.Vars(r)
path := vars["camera_path"]
camera := getService().GetByPath(path)
if camera.Image == nil {
return
}
err := jpeg.Encode(w, camera.Image, nil)
if err != nil {
log.Println(err)
}
}
https://gist.github.com/anonymous/c19c9c6f797d744382a90f35f8ea512f
https://github.com/babell00/toc_camera
Thanks for any Help Kuba