mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix API exception response handling
For some reason when using `render text:` instead of `render json:` for this response, the status code being returned was 200 instead of the clearly explicitly defined 422 (:unprocessable_entity). I absolutely have no idea why!
This commit is contained in:
@@ -73,7 +73,7 @@ module Api
|
||||
end
|
||||
|
||||
def error_during_processing(exception)
|
||||
render(text: { exception: exception.message }.to_json,
|
||||
render(json: { exception: exception.message },
|
||||
status: :unprocessable_entity) && return
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user