[#10966] Fix 500 when email is malformed
This commit is contained in:
parent
fcb868c6a8
commit
478103b01a
2 changed files with 9 additions and 1 deletions
|
@ -2,6 +2,6 @@
|
|||
|
||||
class EmailCheckerController < ApplicationController
|
||||
def show
|
||||
render json: EmailChecker.check(email: params[:email])
|
||||
render json: EmailChecker.check(email: params.permit(:email)[:email])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,5 +45,13 @@ describe EmailCheckerController, type: :controller do
|
|||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
|
||||
context 'malformed' do
|
||||
let(:params) { { email: { some: 'hash' } } }
|
||||
it do
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue