Skip to content

Instantly share code, notes, and snippets.

@stuartnelson3
Created March 24, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartnelson3/ddbf40dea8c49f0d0699f1ac481ac2ac to your computer and use it in GitHub Desktop.
Save stuartnelson3/ddbf40dea8c49f0d0699f1ac481ac2ac to your computer and use it in GitHub Desktop.
trigger retries by responding with a retryable status code
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("got request")
w.WriteHeader(http.StatusServiceUnavailable)
w.Write([]byte("error"))
})
log.Fatal(http.ListenAndServe(":9200", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment