nx-http 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/__tests__/app_pan_baidu_1.rb +6 -1
- data/lib/nx/http.rb +3 -2
- data/lib/nx/version.rb +1 -1
- data/{nx-http-0.1.11.gem → nx-http-0.1.12.gem} +0 -0
- 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: 46aebac08b847f2c90aac11be037957595faecd60cba20195d9bb27c2ba63925
|
4
|
+
data.tar.gz: fd93ba27b9ae6d829f37428080ae94c5e318c3a6a88b7d64903e295efeebc120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24458209b0ccf4a3a8e7b2de3f18d975ea2b1bc9b86e9d22f259c249f27005b1688ded1fa9f1816e3eae0bd7b8c0bc28fc7681d49cac8382227a8dc1aa7d2029
|
7
|
+
data.tar.gz: 524fda2f8b696480c4ae3ea99cee8b92f8e2deeb9d72bf2c9cd03629fec369ffb28c6c1c4b77993b5b8082658f996a25b6c1679e9d8f3fdad8ced56c3389959c
|
@@ -23,6 +23,11 @@ res = Nx::Http.post("https://pan.baidu.com/api/precreate", {
|
|
23
23
|
path: "/db.file",
|
24
24
|
autoinit: 1,
|
25
25
|
block_list: '[""]',
|
26
|
-
})
|
26
|
+
}) do |http, request|
|
27
|
+
request["Content-Type"] = "application/x-www-form-urlencoded"
|
28
|
+
request["Cookie"] = COOKIE
|
29
|
+
request["User-Agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
|
30
|
+
# request.body = "path=/db.file&autoinit=1&block_list=%5B%225910a591dd8fc18c32a8f3df4fdc1761%22%5D"
|
31
|
+
end
|
27
32
|
|
28
33
|
puts res.body
|
data/lib/nx/http.rb
CHANGED
@@ -9,7 +9,7 @@ module Nx
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.request(in_method, in_url, in_data = {}, in_options = {})
|
12
|
-
default_options = { data_type: :urlencoded }
|
12
|
+
default_options = { data_type: :urlencoded, response_type: :raw }
|
13
13
|
options = default_options.merge(in_options)
|
14
14
|
# uri:
|
15
15
|
uri = URI(in_url)
|
@@ -37,7 +37,8 @@ module Nx
|
|
37
37
|
yield(http, request, uri, method) if block_given?
|
38
38
|
|
39
39
|
begin
|
40
|
-
http.request(request)
|
40
|
+
response = http.request(request)
|
41
|
+
options[:response_type] == :json ? JSON.parse(response) : response
|
41
42
|
rescue => exception
|
42
43
|
raise exception
|
43
44
|
end
|
data/lib/nx/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nx-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
@@ -69,7 +69,7 @@ files:
|
|
69
69
|
- lib/nx/data_transform.rb
|
70
70
|
- lib/nx/http.rb
|
71
71
|
- lib/nx/version.rb
|
72
|
-
- nx-http-0.1.
|
72
|
+
- nx-http-0.1.12.gem
|
73
73
|
- nx-http.gemspec
|
74
74
|
- package.json
|
75
75
|
homepage: https://github.com/afeiship/nx-http
|