Skip to content

Commit

Permalink
bug: Work around response_body issue on Rails 5, fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
toupeira committed Nov 7, 2016
1 parent 490f756 commit bc4ac76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/doorkeeper/openid_connect/helpers/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ def validate_prompt_param!(owner)
return true unless prompt_values.include?('none') && !owner

# clear the previous response body to avoid a DoubleRenderError
# TODO: this is currently broken on Rails 5, see
# https://github.com/rails/rails/issues/25106
self.response_body = nil

# FIXME: workaround for Rails 5, see https://github.com/rails/rails/issues/25106
@_response_body = nil

error = ::Doorkeeper::OAuth::ErrorResponse.new(name: :login_required)
response.headers.merge!(error.headers)
render json: error.body, status: error.status
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/doorkeeper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Doorkeeper.configure do
resource_owner_authenticator do
if params[:current_user]
User.new name: params[:current_user]
User.find(params[:current_user])
else
redirect_to('/login')
nil
Expand Down

0 comments on commit bc4ac76

Please sign in to comment.