What happens with the Action Controller::InvalidCrossOriginRequest only in the Rails test case?

Asked 1 years ago, Updated 1 years ago, 107 views

You can hear the action well and it works in the browser, but if you call from the test case like this,

class SubmissionsControllerTest < ActionController::TestCase
    ...
    test "You can get a submission list" do
        get :index, tryout_id: @tryout.id,  format: :js
    end
end

The following error occurs:

Minitest::UnexpectedError: ActionController::InvalidCrossOriginRequest: Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.

What could happen?

ruby-on-rails testcase

2022-09-22 20:45

1 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.