added a json handler
This commit is contained in:
@@ -14,6 +14,13 @@ type prob struct {
|
||||
Last int
|
||||
}
|
||||
|
||||
type JsonHandler func(http.ResponseWriter, *http.Request)
|
||||
|
||||
func (h JsonHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
h(w, req)
|
||||
}
|
||||
|
||||
func problem(w http.ResponseWriter, req *http.Request) {
|
||||
operation := "+"
|
||||
if r := rand.Intn(2); r == 0 {
|
||||
|
||||
Reference in New Issue
Block a user