nice_http 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nice_http/manage/request.rb +16 -4
- data/lib/nice_http/manage/wait_async_operation.rb +4 -2
- 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: 8f688f89208a9399e2ca324654d3dd3230ecb9c4f084e7df64d2354ca3c42115
|
4
|
+
data.tar.gz: acb57ae8b78eba00ffabd3739820b23cf3fa71aa22054da6496732ec53c222d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa146eb3df1800afdc97c38830cafe927ac52d210a8308f7e1e2ec089efbf86fe4ac6623130baf4b19f6672d445cc791cd6a808c573339c0e5194bfac0c0d854
|
7
|
+
data.tar.gz: 6c0810b73dc0ff5fb28f1805073f35e887ef01d40ad2abf37d2544610413dc40911787647236ba83dc6c56ca60afb9708ac733d41bdccf6b74de0e7a9df3a132
|
@@ -11,7 +11,9 @@ module NiceHttpManageRequest
|
|
11
11
|
######################################################
|
12
12
|
def manage_request(*arguments)
|
13
13
|
require "json"
|
14
|
-
|
14
|
+
require 'cgi'
|
15
|
+
require 'uri'
|
16
|
+
|
15
17
|
@prev_request = Hash.new() if @prev_request.nil?
|
16
18
|
@defaults_request = self.class.requests if @defaults_request.nil? and self.class.requests.is_a?(Hash)
|
17
19
|
@request = Hash.new() if @request.nil?
|
@@ -37,9 +39,19 @@ module NiceHttpManageRequest
|
|
37
39
|
path = (@prepath + path).gsub("//", "/") unless path.nil? or path.start_with?("http:") or path.start_with?("https:")
|
38
40
|
|
39
41
|
if @defaults_request.key?(:path) and @defaults_request[:path].is_a?(String) and !@defaults_request[:path].empty?
|
40
|
-
path += "?" if !path.include?("?")
|
41
|
-
path += '&' if path.match?(/\?.+$/) and @defaults_request[:path][0]!='&'
|
42
|
-
|
42
|
+
path += "?" if !path.include?("?")
|
43
|
+
path += '&' if path.match?(/\?.+$/) and @defaults_request[:path][0]!='&' and path[-1]!="&"
|
44
|
+
uri = URI.parse(path)
|
45
|
+
if uri.query.nil?
|
46
|
+
params = {}
|
47
|
+
else
|
48
|
+
params = CGI.parse(uri.query)
|
49
|
+
end
|
50
|
+
urid = URI.parse("/path?#{@defaults_request[:path].gsub(/\?/,'')}")
|
51
|
+
paramsd = CGI.parse(urid.query)
|
52
|
+
paramsd.each do |k,v|
|
53
|
+
path += "&#{k}=#{v[0]}" if !params.key?(k)
|
54
|
+
end
|
43
55
|
end
|
44
56
|
|
45
57
|
@cookies.each { |cookie_path, cookies_hash|
|
@@ -9,7 +9,8 @@ module NiceHttpManageResponse
|
|
9
9
|
resp_async = {body: ''}
|
10
10
|
while time_elapsed <= async_wait_seconds
|
11
11
|
path, data, headers_t = manage_request({ path: location })
|
12
|
-
resp_async = @http.get path
|
12
|
+
resp_async = @http.get path, headers_t
|
13
|
+
@logger.info "\nRESPONSE:\n#{resp_async.code}:#{resp_async.message}\ndata: #{resp_async.body}"
|
13
14
|
completed = resp_async.body.json(async_completed.to_sym)
|
14
15
|
break if completed.to_i == 100 or time_elapsed >= async_wait_seconds
|
15
16
|
time_elapsed += 1
|
@@ -29,7 +30,8 @@ module NiceHttpManageResponse
|
|
29
30
|
resp_orig.async.resource = {}
|
30
31
|
else
|
31
32
|
path, data, headers_t = manage_request({ path: location })
|
32
|
-
resp_async = @http.get path
|
33
|
+
resp_async = @http.get path, headers_t
|
34
|
+
@logger.info "\nRESPONSE:\n#{resp_async.code}:#{resp_async.message}\ndata: #{resp_async.body}"
|
33
35
|
resp_orig.async.resource = {data: resp_async.body}
|
34
36
|
end
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nice_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nice_hash
|