summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2019-08-01 17:27:17 +0100
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2019-08-01 17:27:17 +0100
commitc6902683f661234749464f2d0f026d65c3f87857 (patch)
tree7a126928a18d0032b28926ceb09040030a7e8b9e
parentsimpler and more correct model (diff)
downloadmixed-server-master.tar.gz
mixed-server-master.tar.bz2
mixed-server-master.zip
simpler query parsingHEADmaster
-rw-r--r--go/mixed-server.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/go/mixed-server.go b/go/mixed-server.go
index 2408a44..cf8f13f 100644
--- a/go/mixed-server.go
+++ b/go/mixed-server.go
@@ -6,7 +6,6 @@ import (
"io"
"net"
"net/http"
- "net/url"
"regexp"
"os"
"os/signal"
@@ -87,13 +86,9 @@ func NewHttpController(m Model, v View) *http.ServeMux {
controller := http.NewServeMux()
controller.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
if req.Method == "GET" {
- uri, _ := url.Parse(req.RequestURI)
- q := uri.Query()
- n, _ := q["n"]
var how_many uint
- if len(n) > 0 {
- fmt.Sscanf(n[0], "%d", &how_many)
- }
+ n := req.FormValue("n")
+ fmt.Sscanf(n, "%d", &how_many)
if how_many == 0 {
how_many = 10
}