mirror of
https://github.com/SourceFellows/gobuch.git
synced 2024-10-22 22:05:35 +00:00
27 lines
412 B
Go
27 lines
412 B
Go
|
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)
|
||
|
}
|