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:
parent
fd2a82f41a
commit
1497b298d2
|
@ -365,7 +365,7 @@ class ApplicationController < ActionController::Base
|
|||
Logster.add_to_env(request.env, "username", current_user.username)
|
||||
response.headers["X-Discourse-Username"] = current_user.username
|
||||
end
|
||||
response.headers["X-Discourse-Route"] = "#{controller_name}/#{action_name}"
|
||||
response.headers["X-Discourse-Route"] = "#{controller_path}/#{action_name}"
|
||||
end
|
||||
|
||||
def set_mp_snapshot_fields
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue