nice_http 1.7.13 → 1.7.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/nice_http/manage_request.rb +3 -0
- data/lib/nice_http/utils.rb +7 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: babd398b9461b0732d5b4d5883ea5c500ce2224ace189869e4b562455f8ffe9c
|
4
|
+
data.tar.gz: 9226262b28767a10b3e0c146feaddbe31af20e84eceba86276dbdd93896c1b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0a7a95e2cf65f4d8024514466be2c53ac9294e36d0dbd5c29d20b10244ae91937f7c1565f980aeff1ed2fe2e6165cf3f2ae9d34733ab9685253eaba608b20fe
|
7
|
+
data.tar.gz: b70bda3703c36006221a034c272971adcf7e43fafabef9862e8fa3c1ef97664349a664194fc11695ec2895237037196774a3f202f566de7a64ca1c06aabefe6a
|
data/README.md
CHANGED
@@ -271,6 +271,8 @@ resp = @http.get("/HTTP/Basic/")
|
|
271
271
|
|
272
272
|
```
|
273
273
|
|
274
|
+
In case you want to use strict base64 use the option `strict: true`
|
275
|
+
|
274
276
|
Remember for other kind of authentication systems NiceHttp take care of the redirections and cookies that are requested to be set. In case you need to add a header with a token you can add it by using your NiceHttp object and the key headers, for example:
|
275
277
|
|
276
278
|
```ruby
|
@@ -106,6 +106,7 @@ module NiceHttpManageRequest
|
|
106
106
|
!headers_t["Content-Type"][/application\/jxml/].nil?)
|
107
107
|
if arguments[0].include?(:values_for)
|
108
108
|
arguments[0][:values_for].each { |key, value|
|
109
|
+
#todo: implement set_nested
|
109
110
|
data = NiceHttpUtils.set_value_xml_tag(key.to_s(), data, value.to_s(), true)
|
110
111
|
}
|
111
112
|
end
|
@@ -114,6 +115,7 @@ module NiceHttpManageRequest
|
|
114
115
|
if data.kind_of?(String)
|
115
116
|
if arguments[0].include?(:values_for)
|
116
117
|
arguments[0][:values_for].each { |key, value|
|
118
|
+
#todo: implement set_nested
|
117
119
|
data.gsub!(/"(#{key})":\s*"([^"]*)"/, '"\1": "' + value + '"') # "key":"value"
|
118
120
|
data.gsub!(/(#{key}):\s*"([^"]*)"/, '\1: "' + value + '"') # key:"value"
|
119
121
|
data.gsub!(/(#{key}):\s*'([^']*)'/, '\1: \'' + value + "'") # key:'value'
|
@@ -127,6 +129,7 @@ module NiceHttpManageRequest
|
|
127
129
|
end
|
128
130
|
data = data.to_json()
|
129
131
|
elsif data.kind_of?(Array)
|
132
|
+
#todo: implement set_nested
|
130
133
|
data_arr = Array.new()
|
131
134
|
data.each_with_index { |row, indx|
|
132
135
|
unless row.kind_of?(Hash)
|
data/lib/nice_http/utils.rb
CHANGED
@@ -98,12 +98,17 @@ module NiceHttpUtils
|
|
98
98
|
# input:
|
99
99
|
# user
|
100
100
|
# password
|
101
|
+
# strict: (default: false) use strict_encode64 if true, if not encode64
|
101
102
|
# output:
|
102
103
|
# seed string to be used on Authorization key header on a get request
|
103
104
|
####################################################
|
104
|
-
def self.basic_authentication(user:, password:)
|
105
|
+
def self.basic_authentication(user:, password:, strict: false)
|
105
106
|
require "base64"
|
106
|
-
|
107
|
+
if strict
|
108
|
+
seed = "Basic " + Base64.strict_encode64(user + ":" + password)
|
109
|
+
else
|
110
|
+
seed = "Basic " + Base64.encode64(user + ":" + password)
|
111
|
+
end
|
107
112
|
return seed
|
108
113
|
end
|
109
114
|
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.7.
|
4
|
+
version: 1.7.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nice_hash
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '1.12'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.12.
|
22
|
+
version: 1.12.14
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '1.12'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.12.
|
32
|
+
version: 1.12.14
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|