akita-har_logger 0.2.10 → 0.2.11

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
  SHA256:
3
- metadata.gz: 26fd1b1b5e2ccf962928f85e6969b50f63766571f40cf442cf5b615bb44559e9
4
- data.tar.gz: b6e0ef99924d4b9db81fa0c0981cdc84d41e11930493843c110bc595bdee9447
3
+ metadata.gz: 95fc4c3e51ec19663e862655884702fdcc42aa567f0ca706f1b2dfda065662e5
4
+ data.tar.gz: 04c93b6cc55669bec6b303803928d1c28bd44aa770a7f4b88763cb430f7f7d90
5
5
  SHA512:
6
- metadata.gz: c4953346d8f0f2169aea261ebab4768e3868cfbd0511c0d276791b06b6c2e5871f5d054b869b2d3fed0c99eb5d3cad7712bf7a9dd15d2698052da5e22ff3d756
7
- data.tar.gz: bc46a89f9eeea951a20e34ed9a2bab0c9dee5fd7a8e5ed996d2fe06942d917279345bae0e12c662a0423baff927790dde4c82a99baf834537615deb1d62b796e
6
+ metadata.gz: f76e965199fff57f90f321c3293b6c8447ac1fbfec7d5987ef5bc7e005aa98527d34c33d79f92ff964267b086208d121ad0d25774a19c00f2dbea9455eaf40ab
7
+ data.tar.gz: 287cc1c7f0eb46932b224764171f26612e406afc2d388ee30d5c238000349161741c14afb9def65af27d2703c5ac1c908763241e07e35f269ae1b064a6b8d922
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akita-har_logger (0.2.10)
4
+ akita-har_logger (0.2.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -52,6 +52,9 @@ module Akita
52
52
  saved_input = env['rack.input']
53
53
  env['rack.input'] = StringIO.new request_body
54
54
 
55
+ # Buffer the response body in case it's not a rewindable stream.
56
+ body = HarLogger.bufferBody(body)
57
+
55
58
  @entry_queue << (HarEntry.new start_time, wait_time_ms, env, status,
56
59
  headers, body)
57
60
 
@@ -62,6 +65,13 @@ module Akita
62
65
  end
63
66
  end
64
67
 
68
+ # Reads the given body into an array and returns the result.
69
+ def self.bufferBody(body)
70
+ result = []
71
+ body.each { |part| result << part }
72
+ result
73
+ end
74
+
65
75
  # Logging filter for `ActionController`s.
66
76
  # TODO: Some amount of code duplication here. Should refactor.
67
77
  class Filter
@@ -159,7 +159,9 @@ module Akita
159
159
 
160
160
  def getBodySize(body)
161
161
  length = 0
162
- body.each { |part| length += part.bytesize }
162
+ # Convert each body part into a string in case we're dealing with
163
+ # non-Rack-compliant components.
164
+ body.each { |part| length += part.to_s.bytesize }
163
165
  length
164
166
  end
165
167
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Akita
4
4
  module HarLogger
5
- VERSION = "0.2.10"
5
+ VERSION = "0.2.11"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akita-har_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Liu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2021-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec