Stop logging the namespace
This commit is contained in:
parent
baaa98e04e
commit
9a0326ff09
|
@ -92,9 +92,7 @@ class Grape::Middleware::Logger < Grape::Middleware::Globals
|
||||||
|
|
||||||
def processed_by
|
def processed_by
|
||||||
endpoint = env[Grape::Env::API_ENDPOINT]
|
endpoint = env[Grape::Env::API_ENDPOINT]
|
||||||
parts = endpoint.options[:for].to_s
|
endpoint.options[:for].to_s << '#'.freeze << endpoint.options[:path].map { |path| path.to_s.sub(BACKSLASH, '') }.join(BACKSLASH)
|
||||||
parts << endpoint.namespace if endpoint.namespace != BACKSLASH
|
|
||||||
parts << '#'.freeze << endpoint.options[:path].map { |path| path.to_s.sub(BACKSLASH, '') }.join(BACKSLASH)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_logger
|
def default_logger
|
||||||
|
|
|
@ -28,15 +28,15 @@ describe Grape::Middleware::Logger, type: :integration do
|
||||||
context 'namespacing' do
|
context 'namespacing' do
|
||||||
let(:grape_endpoint) { build(:namespaced_endpoint) }
|
let(:grape_endpoint) { build(:namespaced_endpoint) }
|
||||||
|
|
||||||
it 'designates the namespace with a slash' do
|
it 'ignores the namespacing' do
|
||||||
expect(subject.processed_by).to eq 'TestAPI/admin#users'
|
expect(subject.processed_by).to eq 'TestAPI#users'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with more complex route' do
|
context 'with more complex route' do
|
||||||
let(:grape_endpoint) { build(:namespaced_endpoint, :complex) }
|
let(:grape_endpoint) { build(:namespaced_endpoint, :complex) }
|
||||||
|
|
||||||
it 'only escapes the first slash and leaves the rest of the untouched' do
|
it 'only escapes the first slash and leaves the rest of the untouched' do
|
||||||
expect(subject.processed_by).to eq 'TestAPI/admin#users/:name/profile'
|
expect(subject.processed_by).to eq 'TestAPI#users/:name/profile'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue