diff --git a/main.go b/main.go index 057977f..77f4553 100644 --- a/main.go +++ b/main.go @@ -54,11 +54,6 @@ func addRoutes(api huma.API, glConfig GrandLyonConfig, now func() time.Time) { StopID int `path:"stopID" doc:"Stop id to monitor. Can be obtained using https://data.grandlyon.com/portail/fr/jeux-de-donnees/points-arret-reseau-transports-commun-lyonnais/donnees"` }) (*stopOutput, error) { passages, err := getPassages(ctx, glConfig, now, input.StopID) - if errors.Is(err, errNoPassageFound) { - slog.ErrorContext(ctx, "passage not found", getRequestIDAttr(ctx)) - return nil, huma.NewError(http.StatusNotFound, "no passage found") - } - if err != nil { slog.ErrorContext(ctx, "error getting passages", "err", err, getRequestIDAttr(ctx)) return nil, err diff --git a/main_test.go b/main_test.go index c7eb0c8..e573c95 100644 --- a/main_test.go +++ b/main_test.go @@ -47,11 +47,6 @@ func TestGetStop(t *testing.T) { addRoutes(api, config, now) - t.Run("stop not found", func(t *testing.T) { - resp := api.Get("/tcl/stop/0") - assert.Equal(t, resp.Code, http.StatusNotFound) - }) - t.Run("stop exists", func(t *testing.T) { resp := api.Get("/tcl/stop/290") assert.Equal(t, resp.Code, http.StatusOK) @@ -101,9 +96,6 @@ func TestGetVelovStation(t *testing.T) { transport.RegisterResponder(http.MethodGet, "https://data.grandlyon.com/fr/datapusher/ws/rdata/jcd_jcdecaux.jcdvelov/all.json?maxfeatures=-1&start=1", httpmock.NewBytesResponder(http.StatusOK, httpmock.File("./testdata/station_info.json").Bytes())) - //transport.RegisterResponder(http.MethodGet, - // "https://download.data.grandlyon.com/files/rdata/jcd_jcdecaux.jcdvelov/station_status.json", - // httpmock.NewBytesResponder(http.StatusOK, httpmock.File("./testdata/station_status.json").Bytes())) addRoutes(api, config, time.Now) diff --git a/tcl_stop.go b/tcl_stop.go index 490aff5..ceae384 100644 --- a/tcl_stop.go +++ b/tcl_stop.go @@ -2,7 +2,6 @@ package main import ( "context" - "errors" "fmt" "github.com/carlmjohnson/requests" "net/http" @@ -53,8 +52,6 @@ func (d delay) String() string { } } -var errNoPassageFound = errors.New("no passage found") - func getPassages(ctx context.Context, config GrandLyonConfig, now func() time.Time, stopID int) (*Passages, error) { client := config.Client if client == nil { @@ -93,10 +90,6 @@ func getPassages(ctx context.Context, config GrandLyonConfig, now func() time.Ti passages[key] = delays } - if len(passages) == 0 { - return nil, errNoPassageFound - } - var tclStops TCLStops err = requests.URL("https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclarret/all.json?maxfeatures=-1").