Skip to content

Commit

Permalink
refactor: replace reinvented wheel with Get() in standard library
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Liu <jasonliu747@gmail.com>
  • Loading branch information
jasonliu747 committed Jun 14, 2022
1 parent 5d624d7 commit 63d8cf8
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/koordlet/audit/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -130,9 +129,8 @@ func (a *auditor) gcExpiredReaders(expiredReaders []*readerContext) {

func (a *auditor) HttpHandler() func(http.ResponseWriter, *http.Request) {
return func(rw http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
sizeStr := paramenter(query, "size")
pageToken := paramenter(query, "pageToken")
sizeStr := r.URL.Query().Get("size")
pageToken := r.URL.Query().Get("pageToken")

klog.Infof("handle query client=%v pageToken=%v size=%v", r.RemoteAddr, pageToken, sizeStr)

Expand Down Expand Up @@ -246,14 +244,6 @@ func (a *auditor) Run(stopCh <-chan struct{}) error {
}
}

func paramenter(query url.Values, key string) string {
values, ok := query[key]
if !ok || len(values) == 0 {
return ""
}
return values[0]
}

// emptyAuditor do nothing to mock Auditor
type emptyAuditor struct {
}
Expand Down

0 comments on commit 63d8cf8

Please sign in to comment.