moesif_rack 2.2.2 → 2.2.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d071d1417f743a04c59a0c76348c72c71785e7be66643f9249598cd499ecda4
|
4
|
+
data.tar.gz: '090c2af91b03e6ba513008de2996e4097ed769b9239ae06cf1449d6feec206d0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b883d1aca510cd2f3255f4e38e31e2ed057fd4090b214ab5dcedb5f6abd9a2d169e0257bb547ad82ce966737923346ee7bef446eb0a4b7716774ed5bf067ffa3
|
7
|
+
data.tar.gz: 0b1d306b76342ec2e09fd2739806f0346f82e6c75c87a77cfaf6bb7fc641a95c6ca792ac50becb3728d5d78ca51f52726d676038c22791729f2dcd9a564f88d1
|
@@ -18,7 +18,7 @@ module MoesifRack
|
|
18
18
|
@app = app
|
19
19
|
raise 'application_id required for Moesif Middleware' unless options['application_id']
|
20
20
|
|
21
|
-
@api_client = MoesifApi::MoesifAPIClient.new(options['application_id'], 'moesif-rack/2.2.
|
21
|
+
@api_client = MoesifApi::MoesifAPIClient.new(options['application_id'], 'moesif-rack/2.2.3')
|
22
22
|
@api_controller = @api_client.api
|
23
23
|
|
24
24
|
@api_version = options['api_version']
|
@@ -4,6 +4,25 @@ module Net
|
|
4
4
|
class HTTP
|
5
5
|
alias orig_request request unless method_defined?(:orig_request)
|
6
6
|
|
7
|
+
def extract_body_from_body_stream(body_stream)
|
8
|
+
begin
|
9
|
+
result = nil
|
10
|
+
if body_stream.respond_to?(:rewind) and body_stream.respond_to?(:read)
|
11
|
+
result = body_stream.read
|
12
|
+
body_stream.rewind
|
13
|
+
elsif body_stream.respond_to?(:to_s)
|
14
|
+
result = body_stream.to_s
|
15
|
+
if body_stream.respond_to?(:seek)
|
16
|
+
# if stream respond to seek let's reset seek to 0
|
17
|
+
body_stream.seek(0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
result
|
21
|
+
rescue StandardError => e
|
22
|
+
return nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
7
26
|
def request(request, body = nil, &block)
|
8
27
|
# Request Start Time
|
9
28
|
request_time = Time.now.utc.iso8601(3)
|
@@ -11,8 +30,7 @@ module Net
|
|
11
30
|
url = "https://#{@address}#{request.path}"
|
12
31
|
|
13
32
|
if (not request.body_stream.nil?) && MoesifCaptureOutgoing.should_capture_body
|
14
|
-
req_body_from_stream = request.body_stream
|
15
|
-
request.body_stream.rewind
|
33
|
+
req_body_from_stream = extract_body_from_body_stream(request.body_stream)
|
16
34
|
end
|
17
35
|
|
18
36
|
# Response
|
@@ -61,7 +61,15 @@ module MoesifCaptureOutgoing
|
|
61
61
|
req_content_type = req_headers['content-type'].nil? ? req_headers['Content-Type'] : req_headers['content-type']
|
62
62
|
|
63
63
|
# Request Body
|
64
|
-
req_body_string =
|
64
|
+
req_body_string = nil
|
65
|
+
if not (request.body.nil? || request.body.empty?)
|
66
|
+
req_body_string = request.body;
|
67
|
+
elsif not body_from_req_call.nil?
|
68
|
+
req_body_string = body_from_req_call
|
69
|
+
elsif req_body_from_stream.is_a? String
|
70
|
+
req_body_string = req_body_from_stream
|
71
|
+
end
|
72
|
+
|
65
73
|
req_body_transfer_encoding = nil
|
66
74
|
req_body = nil
|
67
75
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moesif_rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moesif, Inc
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|