initial import

This commit is contained in:
SourceFellows
2020-08-21 06:26:40 +02:00
commit e223458dd4
423 changed files with 9871 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module golang.source-fellows.com/samples/httpretry/server
go 1.13

View File

View File

@ -0,0 +1,26 @@
package main
import (
"fmt"
"net/http"
)
var count int = 0
func handleHttp(res http.ResponseWriter, req *http.Request) {
responseStatus := http.StatusInternalServerError
if count%4 == 0 {
responseStatus = http.StatusOK
}
fmt.Printf("will return %v\n", responseStatus)
res.WriteHeader(responseStatus)
count++
}
func main() {
http.HandleFunc("/", handleHttp)
http.ListenAndServe(":8080", nil)
}