Skip to content

spec-gap: Fix unknown agency returning 200 with null instead of 404 in route-ids-for-agency #970

@3rabiii

Description

@3rabiii

Description

While reviewing the route-ids-for-agency endpoint against the OneBusAway specification, we found that the Go implementation replicates a legacy Java defect.

When a requested agency is not found, the handler currently returns an HTTP 200 OK with a null body. According to the spec (Extension 4a / Suspected Defects), the intended behavior is to return an HTTP 404 error.

Additionally, the existing unit test TestInvalidAgencyIdForRouteIds is incorrectly written to assert this defective 200 + null behavior instead of the specified 404 behavior.

Current Behavior

  • Handler uses api.sendNull(w, r) resulting in a 200 status with null.
  • TestInvalidAgencyIdForRouteIds asserts http.StatusOK.

Expected Behavior (Spec Compliance)

  • Handler should use api.sendNotFound(w, r) to return a standard 404 envelope.
  • The test should be updated to assert http.StatusNotFound and the appropriate error code/text.

Proof

Image

Metadata

Metadata

Assignees

Labels

spec-gapGap found between spec and implementation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions