akita-har_logger 0.2.1 → 0.2.2

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: 8337c88eacb3b48aa2190bb12b2bc406d1140b6e7d7c9c5ed921b5e92fe557c3
4
- data.tar.gz: d6621fcf152e604396634a0614cb9fd66205e95be39be8e46142da90283af8a6
3
+ metadata.gz: c90d947db8a7fb0e4c9188ed34e7275e4697bb9380991f9a734999fe5e0350ab
4
+ data.tar.gz: eb5d3fc053f127f1da20fff703c2a16db0ed667c824dc1172c184a3989ac9ac8
5
5
  SHA512:
6
- metadata.gz: 9efe412f404f5e56abac9af2e79b7d186ab895ceccf40cf369841563f86f5b78eb9ee7fe0cb561b20b7de93a9284343ffa50a355894fe62f6cf3e5d4193ea7d0
7
- data.tar.gz: b251114f5be749a02d8d198e2dbce71ff98845085cdb48324c66e1791d3d6acd7252205cce6f5358f4e3a25fbabfecbba392094e21c56a88e8b0d89528beb408
6
+ metadata.gz: 3b1a61bfed03c77f5f0bd777211255f809beb535767154a294078dabed3ddadccaf6907205cab69a6c5087013567f7848584fe34c0f1795c4e127e5448e254ca
7
+ data.tar.gz: 1eb5fcb88a1b874929710ab249e4d40332cc2fec3cfdd4a5e637d38694ecb7cf434f2d5578c838299736cb26ba820254256a7077b29ddd7a0f81c943b145a190
data/Gemfile.lock CHANGED
@@ -1,14 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akita-har_logger (0.2.1)
5
- json (~> 2.3)
4
+ akita-har_logger (0.2.2)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
9
  diff-lcs (1.4.4)
11
- json (2.5.1)
12
10
  rake (13.0.3)
13
11
  rspec (3.10.0)
14
12
  rspec-core (~> 3.10.0)
@@ -31,7 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ['lib']
33
33
 
34
- spec.add_dependency 'json', '~> 2.3'
35
-
36
34
  spec.add_development_dependency 'rspec', '~> 3.10'
37
35
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
3
  require_relative 'http_request'
5
4
  require_relative 'http_response'
6
5
 
@@ -14,6 +14,17 @@ module Akita
14
14
  })
15
15
  }
16
16
  end
17
+
18
+ # Determines whether all values in a Hash are strings.
19
+ def self.allValuesAreStrings(hash)
20
+ hash.each do |_, value|
21
+ if !(value.is_a? String) then
22
+ return false
23
+ end
24
+ end
25
+
26
+ return true
27
+ end
17
28
  end
18
29
  end
19
30
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
3
  require_relative 'har_utils'
5
4
 
6
5
  module Akita
@@ -81,12 +80,21 @@ module Akita
81
80
  # populate 'text.
82
81
  req = Rack::Request.new env
83
82
  if env['CONTENT_TYPE'] == 'application/x-www-form-urlencoded' then
84
- # Decoded parameters can be found as a map in req.params. Convert
85
- # this map into an array.
83
+ # Decoded parameters can be found as a map in req.params.
86
84
  #
87
- # XXX Spec has space for files, but are file uploads ever
88
- # URL-encoded?
89
- result[:params] = HarUtils.hashToList req.params
85
+ # Requests originating from specs can be malformed: the values in
86
+ # req.params are not necessarily strings. Encode all of req.params
87
+ # in JSON and pretend the content type was "application/json".
88
+ if HarUtils.allValuesAreStrings req.params then
89
+ # Convert req.params into an array.
90
+ #
91
+ # XXX Spec has space for files, but are file uploads ever
92
+ # URL-encoded?
93
+ result[:params] = HarUtils.hashToList req.params
94
+ else
95
+ result[:mimeType] = 'application/json'
96
+ result[:text] = req.params.to_json
97
+ end
90
98
  else
91
99
  result[:text] = req.body.string
92
100
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
3
  require_relative 'har_utils'
5
4
 
6
5
  module Akita
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Akita
4
4
  module HarLogger
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
-
5
3
  module Akita
6
4
  module HarLogger
7
5
  # A thread that consumes HarEntry objects from a queue and writes them to a
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akita-har_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
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-04-21 00:00:00.000000000 Z
11
+ date: 2021-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.3'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.3'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement