Tests: Go application tests.

This commit is contained in:
Andrey Zelenkov
2018-06-08 18:32:55 +03:00
parent 2b39ed5dfb
commit f2a856aa3b
11 changed files with 377 additions and 5 deletions

22
test/go/404/app.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"io"
"io/ioutil"
"net/http"
"nginx/unit"
)
func handler(w http.ResponseWriter, r *http.Request) {
b, e := ioutil.ReadFile("404.html")
if e == nil {
w.WriteHeader(http.StatusNotFound)
io.WriteString(w, string(b))
}
}
func main() {
http.HandleFunc("/", handler)
unit.ListenAndServe(":7080", nil)
}