Skip to content

Commit

Permalink
clean up the code
Browse files Browse the repository at this point in the history
Signed-off-by: omerlh <omerl@soluto.com>
  • Loading branch information
omerlh committed Jun 4, 2019
1 parent 1bd87e9 commit 1a64d57
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2086,18 +2086,10 @@ func validateParsedQuery(body ast.Body) ([]string, error) {

func getStringParam(url *url.URL, name string, ifEmpty string) string {

p, ok := url.Query()[name]
if !ok {
return ifEmpty
}

// Query params w/o values are represented as slice (of len 1) with an
// empty string.
if len(p) == 1 && p[0] == "" {
return ifEmpty
if p := url.Query().Get(name); p != "" {
return p
}

return p[0]
return ifEmpty
}

func getBoolParam(url *url.URL, name string, ifEmpty bool) bool {
Expand Down

0 comments on commit 1a64d57

Please sign in to comment.