Skip to content

Commit

Permalink
remove: unnecessary 'if DEV' check in 'Scraper.fetch()'; change: make…
Browse files Browse the repository at this point in the history
… mock server log more explicit
  • Loading branch information
its-all-waves committed Nov 30, 2024
1 parent 6b19a4b commit a5fa848
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ func (v *Scraper) fetch() *BustimeData {
key := v.config.Key
baseURL := v.config.BaseUrl
url := fmt.Sprintf(cleverDevicesVehicleQueryFormatter, baseURL, key)
if DEV {
url = baseURL
log.Println("Using mock bustime server.")
}
log.Println("Scraper URL:", url)
resp, err := v.client.Get(url)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions mock_bustime_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const port = ":8081"

func main() {
http.HandleFunc(
"/getvehicles",
"/getvehicles", // ignores query params
func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./mock_vehicles.json")
log.Println("GET /getvehicles :: Served Vehicles")
},
)
log.Printf("\n\nMock bustime server is running at: http://localhost%s \n", port)
log.Printf("\n\nMock Clever Devices Bustime server is running at: http://localhost%s \n", port)
log.Fatal(http.ListenAndServe(port, nil))
}

0 comments on commit a5fa848

Please sign in to comment.