mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
parent
2c844b0649
commit
23fbc35b2d
4 changed files with 24 additions and 1 deletions
|
@ -143,7 +143,7 @@ module Devise
|
|||
@controller.response.headers.merge!(headers)
|
||||
@controller.response.content_type = headers["Content-Type"] unless Rails::VERSION::MAJOR >= 5
|
||||
@controller.status = status
|
||||
@controller.response.body = response.body
|
||||
@controller.response_body = response.body
|
||||
nil # causes process return @response
|
||||
end
|
||||
|
||||
|
|
11
test/rails_app/app/controllers/streaming_controller.rb
Normal file
11
test/rails_app/app/controllers/streaming_controller.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class StreamingController < ApplicationController
|
||||
include ActionController::Live
|
||||
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => 'Index'
|
||||
end
|
||||
end
|
|
@ -17,6 +17,8 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :admins, only: [:index]
|
||||
|
||||
resources :streaming, only: [:index]
|
||||
|
||||
# Users scope
|
||||
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
||||
|
||||
|
|
|
@ -196,3 +196,13 @@ class TestControllerHelpersTest < Devise::ControllerTestCase
|
|||
assert_equal old_warden_proxy, new_warden_proxy
|
||||
end
|
||||
end
|
||||
|
||||
class TestControllerHelpersForStreamingControllerTest < Devise::ControllerTestCase
|
||||
tests StreamingController
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
test "doesn't hang when sending an authentication error response body" do
|
||||
get :index
|
||||
assert_equal "<html><body>You are being <a href=\"http://test.host/users/sign_in\">redirected</a>.</body></html>", response.body
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue