Skip to content

Commit

Permalink
Merge pull request #36 from OneBusAway/feature/handle-auth-optional-i…
Browse files Browse the repository at this point in the history
…n-gtfs-realtime

Add check for empty API key and value
  • Loading branch information
aaronbrethorst authored Jan 30, 2025
2 parents c662abc + 662572e commit b9f031f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/metrics/gtfs-realtime-bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func CountVehiclePositions(server models.ObaServer) (int, error) {
if err != nil {
return 0, fmt.Errorf("failed to create HTTP request: %v", err)
}

req.Header.Set(server.GtfsRtApiKey, server.GtfsRtApiValue)
if server.GtfsRtApiKey != "" && server.GtfsRtApiValue != "" {
req.Header.Set(server.GtfsRtApiKey, server.GtfsRtApiValue)
}

client := &http.Client{}
resp, err := client.Do(req)
Expand Down

0 comments on commit b9f031f

Please sign in to comment.