Replies: 2 comments 1 reply
-
I don't think we should change the default behavior. If you are setting the same key for success and error, you are definitely going against how Rodauth is expected to be used. To support what you want, we should extract a method named |
Beta Was this translation helpful? Give feedback.
-
if i understand correctly, we need a new method as you suggested def json_response_error?
!!json_response[json_response_error_key]
end and then we need to add it here as rodauth/lib/rodauth/features/json.rb Lines 23 to 25 in 5c3747b do you accept PR for this if in understanding it correctly |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I'm trying to set the same key
:message
for both error and success keysjson_response_success_key
andjson_response_error_key
in order to get consistent results for example:for failed login:
for successful login:
this is my setup
But I keep getting a 400 status code because this check event if the login was successful
rodauth/lib/rodauth/features/json.rb
Lines 174 to 178 in 5c3747b
is it wrong if we change it to check for
json_response[json_response_field_error_key]
or I'm doing something totally wrongBeta Was this translation helpful? Give feedback.
All reactions