Browse Source

Accept name=name arg instead of only board=name

master
NGnius (Graham) 4 years ago
parent
commit
0370c90ba9
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      handlers.go

+ 8
- 2
handlers.go View File

@@ -33,11 +33,17 @@ func boardHandler(w http.ResponseWriter, r *http.Request) {
}
args := r.URL.Query()
// check args pre-conditions
if !checkArgExists(args, "board", w) {
if !(checkArgExists(args, "board", w) || checkArgExists(args, "name", w)) {
errorResponse(400, "Missing required 'board' URL parameter", w, r)
return
}
board := args.Get("board")
board := ""
if checkArgExists(args, "name", w) {
board = args.Get("name")
}
if checkArgExists(args, "board", w) {
board = args.Get("board")
}
if !checkArgExists(args, "count", w) || !checkArgInt(args, "count", w, 0) {
//w.WriteHeader(400)
errorResponse(400, "Missing required 'count' integer URL parameter", w, r)