Skip to content

Commit 94aceeb

Browse files
Allow site filter query parameters (#99)
1 parent 6aa9583 commit 94aceeb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

handler/handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ func (c *Client) Nearest(rw http.ResponseWriter, req *http.Request) {
192192
}
193193

194194
// Find the nearest targets using the client parameters.
195-
t := req.URL.Query().Get("machine-type")
195+
q := req.URL.Query()
196+
t := q.Get("machine-type")
196197
country := req.Header.Get("X-AppEngine-Country")
197-
opts := &heartbeat.NearestOptions{Type: t, Country: country}
198+
sites := q["site"]
199+
opts := &heartbeat.NearestOptions{Type: t, Country: country, Sites: sites}
198200
targets, urls, err := c.LocatorV2.Nearest(service, lat, lon, opts)
199201
if err != nil {
200202
result.Error = v2.NewError("nearest", "Failed to lookup nearest machines", http.StatusInternalServerError)

0 commit comments

Comments
 (0)