mirror of
https://github.com/samsonjs/grape_logging.git
synced 2026-03-25 08:55:47 +00:00
Merge pull request #87 from pieterocp/misc-typoes
[Misc] Nitpick typoes
This commit is contained in:
commit
16062114b1
4 changed files with 6 additions and 6 deletions
|
|
@ -9,7 +9,7 @@ module GrapeLogging
|
||||||
|
|
||||||
# In some cases, response.body is not parseable by JSON.
|
# In some cases, response.body is not parseable by JSON.
|
||||||
# For example, if you POST on a PUT endpoint, response.body is egal to """".
|
# For example, if you POST on a PUT endpoint, response.body is egal to """".
|
||||||
# It's strange but it's the Grape behavior...
|
# It's strange, but it's the Grape behavior...
|
||||||
def serialized_response_body(response)
|
def serialized_response_body(response)
|
||||||
|
|
||||||
if response.respond_to?(:body)
|
if response.respond_to?(:body)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ module GrapeLogging
|
||||||
@response_status = status
|
@response_status = status
|
||||||
@response_body = response
|
@response_body = response
|
||||||
|
|
||||||
# Perform repotters
|
# Perform reporters
|
||||||
@reporter.perform(collect_parameters)
|
@reporter.perform(collect_parameters)
|
||||||
|
|
||||||
# Invoke loggers
|
# Invoke loggers
|
||||||
|
|
@ -69,7 +69,7 @@ module GrapeLogging
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get status & response from app_response
|
# Get status & response from app_response
|
||||||
# when no error occures.
|
# when no error occurs.
|
||||||
if error
|
if error
|
||||||
# Call with error & response
|
# Call with error & response
|
||||||
after(error[:status], error[:message])
|
after(error[:status], error[:message])
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ describe GrapeLogging::Loggers::RequestHeaders do
|
||||||
OpenStruct.new(env: {HTTP_REFERER: 'http://example.com', HTTP_ACCEPT: 'text/plain'})
|
OpenStruct.new(env: {HTTP_REFERER: 'http://example.com', HTTP_ACCEPT: 'text/plain'})
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:mock_request_with_unhandle_headers) do
|
let(:mock_request_with_unhandled_headers) do
|
||||||
OpenStruct.new(env: {
|
OpenStruct.new(env: {
|
||||||
HTTP_REFERER: 'http://example.com',
|
HTTP_REFERER: 'http://example.com',
|
||||||
"PATH_INFO"=>"/api/v1/users"
|
"PATH_INFO"=>"/api/v1/users"
|
||||||
|
|
@ -27,7 +27,7 @@ describe GrapeLogging::Loggers::RequestHeaders do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'only handle things which start with HTTP_' do
|
it 'only handle things which start with HTTP_' do
|
||||||
expect(subject.parameters(mock_request_with_unhandle_headers, nil)).to eq({
|
expect(subject.parameters(mock_request_with_unhandled_headers, nil)).to eq({
|
||||||
headers: {'Referer' => 'http://example.com' }
|
headers: {'Referer' => 'http://example.com' }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ describe GrapeLogging::Middleware::RequestLogger do
|
||||||
end
|
end
|
||||||
|
|
||||||
[301, 404, 500].each do |the_status|
|
[301, 404, 500].each do |the_status|
|
||||||
context "when the respnse status is #{the_status}" do
|
context "when the response status is #{the_status}" do
|
||||||
let(:status) { the_status }
|
let(:status) { the_status }
|
||||||
it 'should log the correct status code' do
|
it 'should log the correct status code' do
|
||||||
expect(logger).to receive('info') do |arguments|
|
expect(logger).to receive('info') do |arguments|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue