DEV: Include controller namespace in X-Discourse-Route (#29783)

* DEV: Include controller namespace in X-Discourse-Route

* use same separator
This commit is contained in:
Osama Sayegh
2024-11-29 09:11:17 +03:00
committed by GitHub
parent fd2a82f41a
commit 1497b298d2
2 changed files with 17 additions and 1 deletions

View File

@ -1498,4 +1498,20 @@ RSpec.describe ApplicationController do
end
end
end
describe "#set_current_user_for_logs" do
fab!(:admin)
it "sets the X-Discourse-Route header to the controller name and action including namespace" do
sign_in(admin)
get "/admin/users/#{admin.id}.json"
expect(response.status).to eq(200)
expect(response.headers["X-Discourse-Route"]).to eq("admin/users/show")
get "/u/#{admin.username}.json"
expect(response.status).to eq(200)
expect(response.headers["X-Discourse-Route"]).to eq("users/show")
end
end
end