httplog 1.6.2 → 1.7.0

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: 1062236d98f41d145eead34fd281d61e87afc3dd79abd117dfdf2eebb601521e
4
- data.tar.gz: 6edc718624dc88ddeebc38e0f6507bb91f930579b08cf4a8c0cf3c445303e4e6
3
+ metadata.gz: 659ade62ea910dac6d24038c97112f6899c640b4f1da1a1521e86037957ee157
4
+ data.tar.gz: 2c88ab4dd8293017d5ef5aa9101f77b8a0dcfca8c324c5724e1e3499c9ea908d
5
5
  SHA512:
6
- metadata.gz: 67669745059fa38aa79498a4717566219b1aa9e9cc9262e017ecd518e1afa06183ff64b925d33ed2fc0833e6146f92dbca86b9fad83005c96f2851590f580821
7
- data.tar.gz: 9e478ad5b103b90911b600d30df17b84154a0c66afc740856601fd1466980aaf834c6fbafaa55f3bde38b258f352f91aa47d89bde5f2eb64b8cdf6e32f4f45c1
6
+ metadata.gz: a8d277e613b0cfca71196bf7cc4288c3c7f26bd919410bdc5e6c94e5de5d14a45944cff130da1d2d29aa66f09ca74fd2e112b2a7b243c27e0a3dca4387b74052
7
+ data.tar.gz: 4927a60e3eba5195539e890dbb69861eee96fcf9e7d2bb736638085bc15e3e6280ea726b78e95f5702f36cdb05290464eb6ae9b36b3dbfe9586c6afe5dd11462
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 1.7.0 - 2024-06-08
2
+
3
+ * [#138](https://github.com/trusche/httplog/pull/138) Support for Faraday v2
4
+
5
+ ## 1.6.3 - 2024-02-25
6
+
7
+ * Dependecy updates
8
+ * [#137](https://github.com/trusche/httplog/pull/137) Fix case sensitivity on response headers
9
+
10
+ ## 1.6.2 - 2022-11-19
11
+
12
+ * Added rubygems.org metadata
13
+ * Gem dependency updates
14
+
15
+ ## 1.6.0 - 2022-09-17
16
+
17
+ * Gem upgrades
18
+ * [#110](https://github.com/trusche/httplog/pull/110) Fix for empty body response
19
+ * [#111](https://github.com/trusche/httplog/pull/111) Removed runtime dependencies
20
+ * Dependency updates
21
+ * Fix the missing Ethon log info #124
22
+
1
23
  ## 1.5.0 - 2021-05-20
2
24
 
3
25
  * Support for Ruby 2.7 and frozen strings
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  ## httplog
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/httplog.svg)](http://badge.fury.io/rb/httplog) [![Build Status](https://travis-ci.com/trusche/httplog.svg?branch=master)](https://travis-ci.org/trusche/httplog) [![Code Climate](https://codeclimate.com/github/trusche/httplog.svg)](https://codeclimate.com/github/trusche/httplog)
3
+ [![Gem Version](https://badge.fury.io/rb/httplog.svg)](http://badge.fury.io/rb/httplog)
4
+ [![Build Status](https://app.travis-ci.com/trusche/httplog.svg?token=puaZacCmspVoUFGP2EYr&branch=master)](https://app.travis-ci.com/trusche/httplog)
5
+ [![Code Climate](https://codeclimate.com/github/trusche/httplog.svg)](https://codeclimate.com/github/trusche/httplog)
4
6
  [![Release Version](https://img.shields.io/github/release/trusche/httplog.svg)](https://img.shields.io/github/release/trusche/httplog.svg)
5
7
 
6
8
  Log outgoing HTTP requests made from your application. Helps with debugging pesky API error responses, or just generally understanding what's going on under the hood.
7
9
 
8
- Requires ruby >= 2.6
10
+ Requires ruby >= 2.6.
9
11
 
10
12
  This gem works with the following ruby modules and libraries:
11
13
 
data/httplog.gemspec CHANGED
@@ -32,9 +32,10 @@ Gem::Specification.new do |gem|
32
32
 
33
33
  gem.add_development_dependency 'ethon', ['~> 0.11']
34
34
  gem.add_development_dependency 'excon', ['~> 0.60']
35
- gem.add_development_dependency 'faraday', ['~> 1.3']
35
+ gem.add_development_dependency 'faraday', ['>= 1.3']
36
+ gem.add_development_dependency 'faraday-multipart', ['>= 1.0']
36
37
  gem.add_development_dependency 'guard-rspec', ['~> 4.7']
37
- gem.add_development_dependency 'http', ['~> 4.0']
38
+ gem.add_development_dependency 'http', ['>= 4.0']
38
39
  gem.add_development_dependency 'httparty', ['~> 0.16']
39
40
  gem.add_development_dependency 'httpclient', ['~> 2.8']
40
41
  gem.add_development_dependency 'rest-client', ['~> 2.0']
@@ -47,8 +47,8 @@ if defined?(Ethon)
47
47
  @on_complete.unshift -> (*) do
48
48
  # Not sure where the actual status code is stored - so let's
49
49
  # extract it from the response header.
50
- encoding = response_headers.scan(/Content-Encoding: (\S+)/).flatten.first
51
- content_type = response_headers.scan(/Content-Type: (\S+(; charset=\S+)?)/).flatten.first
50
+ encoding = response_headers.scan(/Content-Encoding: (\S+)/i).flatten.first
51
+ content_type = response_headers.scan(/Content-Type: (\S+(; charset=\S+)?)/i).flatten.first
52
52
 
53
53
  # Hard to believe that Ethon wouldn't parse out the headers into
54
54
  # an array; probably overlooked it. Anyway, let's do it ourselves:
@@ -19,6 +19,7 @@ if defined?(::HTTPClient)
19
19
  request_uri = req.header.request_uri
20
20
  if HttpLog.url_approved?(request_uri)
21
21
  res = conn.pop
22
+ headers = res.headers.transform_keys(&:downcase)
22
23
 
23
24
  HttpLog.call(
24
25
  method: req.header.request_method,
@@ -27,10 +28,10 @@ if defined?(::HTTPClient)
27
28
  request_headers: req.headers,
28
29
  response_code: res.status_code,
29
30
  response_body: res.body,
30
- response_headers: res.headers,
31
+ response_headers: headers,
31
32
  benchmark: bm,
32
- encoding: res.headers['Content-Encoding'],
33
- content_type: res.headers['Content-Type'],
33
+ encoding: headers['content-encoding'],
34
+ content_type: headers['content-type'],
34
35
  mask_body: HttpLog.masked_body_url?(request_uri)
35
36
  )
36
37
  conn.push(res)
@@ -10,6 +10,8 @@ if defined?(Patron)
10
10
  end
11
11
 
12
12
  if HttpLog.url_approved?(url)
13
+ normalized_headers = @response.headers.transform_keys(&:downcase)
14
+
13
15
  HttpLog.call(
14
16
  method: action_name,
15
17
  url: url,
@@ -17,10 +19,10 @@ if defined?(Patron)
17
19
  request_headers: headers,
18
20
  response_code: @response.status,
19
21
  response_body: @response.body,
20
- response_headers: @response.headers,
22
+ response_headers: normalized_headers,
21
23
  benchmark: bm,
22
- encoding: @response.headers['Content-Encoding'],
23
- content_type: @response.headers['Content-Type'],
24
+ encoding: normalized_headers['content-encoding'],
25
+ content_type: normalized_headers['content-type'],
24
26
  mask_body: HttpLog.masked_body_url?(url)
25
27
  )
26
28
  end
@@ -319,6 +319,8 @@ module HttpLog
319
319
  string_classes << HTTP::URI if defined?(HTTP::URI)
320
320
  string_classes << URI::HTTP if defined?(URI::HTTP)
321
321
  string_classes << HTTP::FormData::Urlencoded if defined?(HTTP::FormData::Urlencoded)
322
+ string_classes << Addressable::URI if defined?(Addressable::URI)
323
+ string_classes << HTTPClient::Util::AddressableURI if defined?(HTTPClient::Util::AddressableURI)
322
324
  string_classes
323
325
  end
324
326
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HttpLog
4
- VERSION = '1.6.2'.freeze
4
+ VERSION = '1.7.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httplog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thilo Rusche
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-19 00:00:00.000000000 Z
11
+ date: 2024-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ethon
@@ -42,16 +42,30 @@ dependencies:
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday-multipart
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: guard-rspec
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -70,14 +84,14 @@ dependencies:
70
84
  name: http
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '4.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '4.0'
83
97
  - !ruby/object:Gem::Dependency
@@ -290,7 +304,7 @@ metadata:
290
304
  bug_tracker_uri: https://github.com/trusche/httplog/issues
291
305
  changelog_uri: https://github.com/trusche/httplog/blob/master/CHANGELOG.md
292
306
  source_code_uri: https://github.com/trusche/httplog
293
- post_install_message:
307
+ post_install_message:
294
308
  rdoc_options: []
295
309
  require_paths:
296
310
  - lib
@@ -305,8 +319,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
319
  - !ruby/object:Gem::Version
306
320
  version: '0'
307
321
  requirements: []
308
- rubygems_version: 3.3.7
309
- signing_key:
322
+ rubygems_version: 3.5.9
323
+ signing_key:
310
324
  specification_version: 4
311
325
  summary: Log outgoing HTTP requests.
312
326
  test_files: []