nice_http 1.9.0 → 1.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05ea4d762f4ce03ab7f89c6ca4aafd323c549c73f686f349dac356e43918ffa5
4
- data.tar.gz: a9f1c491dabcd6e559f9454a10a7caeeddea4aac915d10be0548d5465fe1a256
3
+ metadata.gz: 8f688f89208a9399e2ca324654d3dd3230ecb9c4f084e7df64d2354ca3c42115
4
+ data.tar.gz: acb57ae8b78eba00ffabd3739820b23cf3fa71aa22054da6496732ec53c222d8
5
5
  SHA512:
6
- metadata.gz: 5744a1f61ef6835e7dca5fffa15617e7ecd842b28f4cdb7019f1583e95483d841ccdee5d07506d2e7d9d6b8e5ba6dc986e5425f89b20b91abec9ebfab555917c
7
- data.tar.gz: f33f3d76090238a2f9b483a2791b295a908355072586d418f185c8326c3096700f3f89f5e477eb3e0191d256fd824ced3974d5ec628b34aba3ce0bd99179fa63
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?("?") and !@defaults_request[:path].include?("?")
41
- path += '&' if path.match?(/\?.+$/) and @defaults_request[:path][0]!='&'
42
- path += @defaults_request[:path]
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.0
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-24 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nice_hash