Is there a way in lacinia-pedestal
to set the HTTP status code of a request? My API requires authentication and error handling on the client side would be a lot easier if one could also signal errors on the HTTP protocol level.
Sorry, for asking too soon, the answer is here: https://lacinia-pedestal.readthedocs.io/en/latest/response.html Just like that:
(resolve/resolve-as nil {:message "Access denied."
:status 403})
Slight pushback: Although authorization is probably okay to do with status codes (we do so too), its often encouraged in GraphQL to return 200 + error messages, or 200 + some kind of schema error.
For example: https://medium.com/@sachee/200-ok-error-handling-in-graphql-7ec869aec9bc