httpigeon 2.3.0 → 2.3.2
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/.github/workflows/reviewdog.yaml +1 -1
- data/CHANGELOG.md +14 -0
- data/lib/httpigeon/request.rb +13 -17
- data/lib/httpigeon/response.rb +3 -2
- data/lib/httpigeon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e3bd2f3ebb052aef6119e86ec9674f35f1911bb84ec7364a9824b7eb2949778
|
4
|
+
data.tar.gz: 5de39fb7884ec828b7d3c8cec04f6db9bbb45fb92eda41c199bacf95f1d1b7af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db8c4a98307aad75072babc2e895bb77b1e316c1c445ee0cc7cb0253a107279fec373319af05ef4f0b3c3ac8fb9f3d4e34881530b6da44ad691e61968eb6b4d2
|
7
|
+
data.tar.gz: '099de00614d03209354863f72b3839c8760bbba5f0ace4e604b4c54000a18f2b97d21a6c9f6c7d36604b14675282c9de53300ae870ff5294962878890f23c3c5'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.3.2](https://github.com/dailypay/httpigeon/compare/v2.3.1...v2.3.2) (2024-11-14)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **UNTICKETED:** Dont parse pdf as json ([#44](https://github.com/dailypay/httpigeon/issues/44)) ([fd4c13c](https://github.com/dailypay/httpigeon/commit/fd4c13cbb6c8084aa054c2daa756ace651e1338b))
|
9
|
+
|
10
|
+
## [2.3.1](https://github.com/dailypay/httpigeon/compare/v2.3.0...v2.3.1) (2024-07-11)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* Execute block within scope ([#42](https://github.com/dailypay/httpigeon/issues/42)) ([a9a43c3](https://github.com/dailypay/httpigeon/commit/a9a43c391b449b3316812e1c99fb88e25c923b31))
|
16
|
+
|
3
17
|
## [2.3.0](https://github.com/dailypay/httpigeon/compare/v2.2.0...v2.3.0) (2024-07-11)
|
4
18
|
|
5
19
|
|
data/lib/httpigeon/request.rb
CHANGED
@@ -38,9 +38,9 @@ module HTTPigeon
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
attr_reader :connection, :response, :
|
41
|
+
attr_reader :connection, :response, :base_url, :fuse
|
42
42
|
|
43
|
-
delegate :status, :body, to: :response, prefix: true
|
43
|
+
delegate :status, :body, :parsed_response, to: :response, prefix: true
|
44
44
|
|
45
45
|
def initialize(base_url:, options: nil, headers: nil, adapter: nil, logger: nil, event_type: nil, log_filters: nil, fuse_config: nil)
|
46
46
|
@base_url = URI.parse(base_url)
|
@@ -77,7 +77,17 @@ module HTTPigeon
|
|
77
77
|
|
78
78
|
connection.headers[REQUEST_ID_HEADER] = SecureRandom.uuid if HTTPigeon.auto_generate_request_id
|
79
79
|
|
80
|
-
raw_response = HTTPigeon.mount_circuit_breaker
|
80
|
+
raw_response = if HTTPigeon.mount_circuit_breaker
|
81
|
+
fuse.execute(request_id: connection.headers[REQUEST_ID_HEADER]) do
|
82
|
+
connection.send(method, path, payload) do |request|
|
83
|
+
yield(request) if block_given?
|
84
|
+
end
|
85
|
+
end
|
86
|
+
else
|
87
|
+
connection.send(method, path, payload) do |request|
|
88
|
+
yield(request) if block_given?
|
89
|
+
end
|
90
|
+
end
|
81
91
|
|
82
92
|
@response = HTTPigeon::Response.new(self, raw_response)
|
83
93
|
end
|
@@ -93,19 +103,5 @@ module HTTPigeon
|
|
93
103
|
def default_headers
|
94
104
|
{ 'Accept' => 'application/json' }
|
95
105
|
end
|
96
|
-
|
97
|
-
def simple_run(method, path, payload)
|
98
|
-
connection.send(method, path, payload) do |request|
|
99
|
-
yield(request) if block_given?
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def run_with_fuse(method, path, payload)
|
104
|
-
fuse.execute(request_id: connection.headers[REQUEST_ID_HEADER]) do
|
105
|
-
simple_run(method, path, payload) do |request|
|
106
|
-
yield(request) if block_given?
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
106
|
end
|
111
107
|
end
|
data/lib/httpigeon/response.rb
CHANGED
@@ -5,7 +5,7 @@ module HTTPigeon
|
|
5
5
|
attr_reader :request, :parsed_response, :raw_response
|
6
6
|
|
7
7
|
delegate :each, :to_h, :to_json, :with_indifferent_access, to: :parsed_response
|
8
|
-
delegate :status, :body, :env, to: :raw_response
|
8
|
+
delegate :status, :body, :env, :headers, to: :raw_response
|
9
9
|
|
10
10
|
def initialize(request, raw_response)
|
11
11
|
@request = request
|
@@ -25,7 +25,8 @@ module HTTPigeon
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def parse_response
|
28
|
-
|
28
|
+
parsable_content_type = headers.blank? || headers['content-type'].blank? || headers['content-type'].include?('application/json')
|
29
|
+
parsed_body = body.is_a?(String) && parsable_content_type ? JSON.parse(body) : body
|
29
30
|
@parsed_response = deep_with_indifferent_access(parsed_body)
|
30
31
|
rescue JSON::ParserError
|
31
32
|
@parsed_response = body.presence || {}
|
data/lib/httpigeon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpigeon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 2k-joker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|