Pushjet / Pushjet-Server-Api

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

Return appropriate HTTP status codes on error #18

Closed obskyr closed 8 years ago

obskyr commented 8 years ago

This pull request makes sure errors actually return non-OK HTTP status codes. Before, all requests (that didn't cause an actual uncaught exception serverside) returned 200. With this change, they instead return what they should according to the documentation, and as for the undocumented ones according to common sense.

With this pull request, the errors are mapped as following:

Pretty nice, eh? This also resolves #17.

Mechazawa commented 8 years ago

Nice, I just need to make sure this is reflected in the docs from now on.

Mechazawa commented 8 years ago

Error.CONNECTION_CLOSING WAS used when websockets were still in the API instead of a connector. I should remove it some time.