Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors are sent in text/plain rather than json content-type #112

Open
thbar opened this issue Jan 18, 2021 · 1 comment
Open

Errors are sent in text/plain rather than json content-type #112

thbar opened this issue Jan 18, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@thbar
Copy link
Collaborator

thbar commented Jan 18, 2021

During my manual tests of #109, I noticed that when the base schedule is not available, we get a text/plain error currently.

Here is an example, using a local test config and querying http://localhost:8080/test:

HTTP/1.1 502 Bad Gateway
content-length: 170
connection: close
content-type: text/plain; charset=utf-8
date: Mon, 18 Jan 2021 10:01:12 GMT

theoretical dataset temporarily unavailable : impossible to read GTFS http://localhost:8000/SEM-GTFS.zip because Invalid Zip archive: Could not find central directory end

Since the whole API is JSON, I believe standardising on JSON content-type of errors would be better for the end-user life.

Useful resources

@thbar thbar added the enhancement New feature or request label Jan 18, 2021
@thbar
Copy link
Collaborator Author

thbar commented Jan 18, 2021

The encoding is also not set as a header, leading to this output on some browsers:

CleanShot 2021-01-18 at 11 58 38@2x

It would be a good idea to fix this at the same time, with a Content-Type: application/json; charset=utf-8 (but maybe just switching to JSON) will correct that as well, actually.

@thbar thbar changed the title Errors sent in text/plain rather than json content-type Errors are sent in text/plain rather than json content-type Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant