【问题标题】:django-rest-auth password change responds with ErrorDetails objectdjango-rest-auth 密码更改以 ErrorDetails 对象响应
【发布时间】:2020-01-27 15:47:10
【问题描述】:

我正在使用django-rest-auth 使用 API 进行身份验证。我正在编写测试以检查当密码 1 和密码 2 不同时我的应用程序是否相应地工作。 我在响应中收到一个 ErrorDetail 对象而不是字符串。

回应:

{'new_password2': [ErrorDetail(string='The two password fields didn’t match.', code='invalid')]}

预期响应:

{'new_password2': 'The two password fields didn’t match.'}

【问题讨论】:

    标签: django django-rest-auth


    【解决方案1】:

    您可以使用str() 将错误对象转换为字符串。

    【讨论】:

      猜你喜欢
      • 2019-05-25
      • 2015-03-16
      • 2020-05-21
      • 2016-12-21
      • 2014-06-10
      • 1970-01-01
      • 2017-04-07
      • 2018-06-04
      • 1970-01-01
      相关资源
      最近更新 更多