Fork me on GitHub
#graphql
<
2020-08-13
>
defa09:08:02

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.

Lennart Buit20:08:28

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.

defa09:08:41

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})

👍 6