File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,7 @@ type NearestRequest struct {
7
7
Profile string
8
8
GeoPath GeoPath
9
9
Bearings []Bearing
10
-
11
- Number int
10
+ Number int
12
11
}
13
12
14
13
// NearestResponse represents a response from the nearest method
@@ -32,7 +31,9 @@ type nearestResponseOrError struct {
32
31
33
32
func (r NearestRequest ) request () * request {
34
33
opts := options {}
35
- opts .addInt ("number" , r .Number )
34
+ if r .Number >= 1 {
35
+ opts .addInt ("number" , r .Number )
36
+ }
36
37
37
38
if len (r .Bearings ) > 0 {
38
39
opts .set ("bearings" , bearings (r .Bearings ))
Original file line number Diff line number Diff line change @@ -17,4 +17,14 @@ func TestNearestRequestOverviewOption(t *testing.T) {
17
17
t ,
18
18
"bearings=60%2C380&number=2" ,
19
19
req .request ().options .encode ())
20
+
21
+ req = NearestRequest {
22
+ Bearings : []Bearing {
23
+ {60 , 380 },
24
+ },
25
+ }
26
+ assert .Equal (
27
+ t ,
28
+ "bearings=60%2C380" ,
29
+ req .request ().options .encode ())
20
30
}
You can’t perform that action at this time.
0 commit comments