Skip to content

Request headers for GTFS-RT updates #2796

Description

@irees

Expected behavior

If an HTTP client is expecting protobuf data, it should specify an appropriate mime-type in the "Accept" header, such as "application/x-google-protobuf" or "application/octet-stream". Most HTTP clients also specify "*/*" as a general fallback.

Observed behavior

OTP does not include an "Accept" Header when requesting GTFS-RT data.

Version of OTP used (exact commit hash or JAR name)

latest dev-1.x 4513d7e

Data sets in use (links to GTFS and OSM PBF files)

Bay Area MTC GTFS-RT endpoints; these will return JSON data instead of protobuf if the "Accept" header is not specified. The API does have a "format" parameter but it does not seem to allow protobuf to be explicitly specified.

Command line used to start OTP

java -jar otp.jar --server --port 8000 --graphs . --autoScan

Router config and graph build config JSON

Plain router-config with an updater that specifies one of these endpoints (exact config omitted because they require an API key).

Steps to reproduce the problem

See above.

Proposed solution

When requesting service alerts or trip updates, add "Accept: application/x-google-protobuf; application/octet-stream; */*" to the HTTP request headers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions