Pushjet / Pushjet-Server-Api

The Pushjet server software
https://api.pushjet.io
BSD 2-Clause "Simplified" License
253 stars 37 forks source link

Nonexistent services respond with 200 OK #17

Closed obskyr closed 8 years ago

obskyr commented 8 years ago

Despite what the documentation says on the matter, a GET on https://api.pushjet.io/service does not respond with a 404 if the requested service does not exist. Instead, it responds with a 200, but still provides the error information in the body.

A small demonstrative curl:

> curl -i https://api.pushjet.io/service?service=totally-a-public-key
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 12 Oct 2016 02:46:59 GMT
Content-Type: application/json
Content-Length: 66
Connection: keep-alive

{
  "error": {
    "id": 2,
    "message": "Invalid service"
  }
}

Nicely enough fixing this doesn't break compatibility, even with people's current workarounds.