Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error returned when no data is POSTed to registration controller #203

Closed
mchavarriagam opened this issue Apr 5, 2015 · 1 comment
Closed

Comments

@mchavarriagam
Copy link
Contributor

Hello,

When posting an empty body to the Registration controller, a 500 error is returned:

NoMethodError in DeviseTokenAuth::RegistrationsController#create
undefined method `downcase' for nil:NilClass
Extracted source (around line #12):

  # honor devise configuration for case_insensitive_keys
  if resource_class.case_insensitive_keys.include?(:email)
    -> @resource.email = sign_up_params[:email].downcase
  else
    @resource.email = sign_up_params[:email]
  end

I'm currently working on an API which uses DTA so I have no way of ensuring that the client will send proper sign up data in POST body. I can do a PR for this but I'd like to make sure I'm going the right way about it:

  1. Adding before_filter on registrations_controller (validate_sign_up_body perhaps? only for post)
  2. validate_sign_up_body returns 422 unprocessable entity + json errors: 'Please post proper sign up data in request body.' if sign_up_params is empty.

Does that sound good?

Cheers.

@mchavarriagam
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant