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:
Error.NONE - 200 OK
Error.INVALID_CLIENT - 400 Bad request
Error.INVALID_SERVICE - 400 Bad request
Error.INVALID_SECRET - 400 Bad request
Error.DUPLICATE_LISTEN - 409 Conflict
Error.RATE_TOOFAST - 429 Too many requests
Error.SERVICE_NOTFOUND - 404 Not found
Error.ARGUMENT_MISSING - 400 Bad request
Error.INVALID_PUBKEY - 400 Bad request (Though this error is never used.)
Error.CONNECTION_CLOSING - 499 Client closed request (I wasn't sure about this one either, since it also goes unused.)
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:
Error.NONE
- 200 OKError.INVALID_CLIENT
- 400 Bad requestError.INVALID_SERVICE
- 400 Bad requestError.INVALID_SECRET
- 400 Bad requestError.DUPLICATE_LISTEN
- 409 ConflictError.RATE_TOOFAST
- 429 Too many requestsError.SERVICE_NOTFOUND
- 404 Not foundError.ARGUMENT_MISSING
- 400 Bad requestError.INVALID_PUBKEY
- 400 Bad request (Though this error is never used.)Error.CONNECTION_CLOSING
- 499 Client closed request (I wasn't sure about this one either, since it also goes unused.)Error.NO_CHANGES
- 400 Bad requestPretty nice, eh? This also resolves #17.