api_hammer 0.13.2 → 0.13.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dc5455b30c8dc15be3424b468aa3fce4816deae
4
- data.tar.gz: 035a1c11f8da0d6d57d23a1af044e1db1c463fb1
3
+ metadata.gz: 0ec8f15a064560aa1f4f50123bbcf2a334130488
4
+ data.tar.gz: c29ed9ef11362ef5a872d617d656b3a56c879198
5
5
  SHA512:
6
- metadata.gz: 379b3299919248418c89c1969f82176d8e84354b1175e09fb5a5dea3463d51901f462f610d8f734fa5b60966286bccfeef7bc5bdd2effef8c4b7e52c59149689
7
- data.tar.gz: 6ba8b12bf7906f3c6933aa83f5c05bbc7ff7bd65e1e73f0f876d9783ff95b2649ed2b5937ba427b1d1383e504a333adee92ea75b499ad1d2878ca06cf8af8ad0
6
+ metadata.gz: c681350085a2cbcfbfc208f988ce91700e98b5350a1bd13d26ca06008a256e5a159c40b88b2f236944097549c334908b05af1ae30ce907d4421187f76d84bf2e
7
+ data.tar.gz: 92ae18c0f12d10abb11829e129fcd648142910b0ccbcbcaeeaf06ec072785c4bcfea46841002e3bef16149859652a32b40273d7d52ef87b14f3fa1391abce6da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # v0.13.3
2
+ - fix bug when logging non-ascii bodies with filtration enabled
3
+
1
4
  # v0.13.2
2
5
  - fix with_indifferent_access usage when we don't depend on activesupport
3
6
 
@@ -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.jsonifiable.filtered(@options.reject { |k,v| ![:filter_keys].include?(k) }).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
@@ -1,3 +1,3 @@
1
1
  module ApiHammer
2
- VERSION = "0.13.2"
2
+ VERSION = "0.13.3"
3
3
  end
@@ -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.2
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-01-28 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack