sqlitebrowser / dbhub.io

A "Cloud" for SQLite databases. Collaborative development for your data. 😊
https://dbhub.io
GNU Affero General Public License v3.0
371 stars 39 forks source link

api: Ensure the caller receives a JSON response even for API access errors #295

Closed justinclift closed 8 months ago

justinclift commented 8 months ago

This commit returns a JSON "error" string when an API authorisation error occurs (ie missing API key, or an API key with insufficient access).

Prior to this, the only indication that something was wrong was through the response header status code.

Was super confusing when using curl with jq (curl ... | jq) to process responses, only to have what looked like silent failures. ;)

justinclift commented 8 months ago

Oops. Noticed a typo in a bad spot in the commit message after merging this. So I've just fixed it (via forced push) in master.