api_hammer 0.13.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/api_hammer/request_logger.rb +1 -1
- data/lib/api_hammer/version.rb +1 -1
- data/test/request_logger_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec8f15a064560aa1f4f50123bbcf2a334130488
|
4
|
+
data.tar.gz: c29ed9ef11362ef5a872d617d656b3a56c879198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c681350085a2cbcfbfc208f988ce91700e98b5350a1bd13d26ca06008a256e5a159c40b88b2f236944097549c334908b05af1ae30ce907d4421187f76d84bf2e
|
7
|
+
data.tar.gz: 92ae18c0f12d10abb11829e129fcd648142910b0ccbcbcaeeaf06ec072785c4bcfea46841002e3bef16149859652a32b40273d7d52ef87b14f3fa1391abce6da
|
data/CHANGELOG.md
CHANGED
@@ -117,7 +117,7 @@ module ApiHammer
|
|
117
117
|
if content_type_attrs.text?
|
118
118
|
if (400..599).include?(status.to_i) || body.size < LARGE_BODY_SIZE
|
119
119
|
# log bodies if they are not large, or if there was an error (either client or server)
|
120
|
-
data[role]['body'] = parsed_body.
|
120
|
+
data[role]['body'] = parsed_body.filtered(@options.reject { |k,v| ![:filter_keys].include?(k) }).jsonifiable.body
|
121
121
|
else
|
122
122
|
# otherwise, log id and uuid fields
|
123
123
|
body_object = parsed_body.object
|
data/lib/api_hammer/version.rb
CHANGED
data/test/request_logger_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
proc { |p| $:.unshift(p) unless $:.any? { |lp| File.expand_path(lp) == p } }.call(File.expand_path('.', File.dirname(__FILE__)))
|
2
3
|
require 'helper'
|
3
4
|
require 'logger'
|
@@ -66,6 +67,16 @@ describe ApiHammer::RequestLogger do
|
|
66
67
|
|
67
68
|
assert_includes(logio.string, %q("body":"{\"pin\": \"[FILTERED]\"}"))
|
68
69
|
end
|
70
|
+
|
71
|
+
it 'filters unicode' do
|
72
|
+
body = %Q({"key": "Björn"})
|
73
|
+
app = proc { |env| [200, {"Content-Type" => 'application/json; charset=utf-8'}, [body]] }
|
74
|
+
app = ApiHammer::RequestLogger.new(app, logger)
|
75
|
+
app.call(Rack::MockRequest.env_for('/')).last.close
|
76
|
+
|
77
|
+
assert_includes(logio.string, %q("body":"{\"key\": \"Björn\"}"))
|
78
|
+
end
|
79
|
+
|
69
80
|
it 'filters nested' do
|
70
81
|
body = %Q({"object": {"pin": "foobar"}})
|
71
82
|
app = proc { |env| [200, {"Content-Type" => 'application/json; charset=UTF8'}, [body]] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_hammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|