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
|
||||
endpoint = env[Grape::Env::API_ENDPOINT]
|
||||
parts = endpoint.options[:for].to_s
|
||||
parts << endpoint.namespace if endpoint.namespace != BACKSLASH
|
||||
parts << '#'.freeze << endpoint.options[:path].map { |path| path.to_s.sub(BACKSLASH, '') }.join(BACKSLASH)
|
||||
endpoint.options[:for].to_s << '#'.freeze << endpoint.options[:path].map { |path| path.to_s.sub(BACKSLASH, '') }.join(BACKSLASH)
|
||||
end
|
||||
|
||||
def default_logger
|
||||
|
|
|
@ -28,15 +28,15 @@ describe Grape::Middleware::Logger, type: :integration do
|
|||
context 'namespacing' do
|
||||
let(:grape_endpoint) { build(:namespaced_endpoint) }
|
||||
|
||||
it 'designates the namespace with a slash' do
|
||||
expect(subject.processed_by).to eq 'TestAPI/admin#users'
|
||||
it 'ignores the namespacing' do
|
||||
expect(subject.processed_by).to eq 'TestAPI#users'
|
||||
end
|
||||
|
||||
context 'with more complex route' do
|
||||
let(:grape_endpoint) { build(:namespaced_endpoint, :complex) }
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue