simple-http 0.1.3 → 0.1.4
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 +4 -4
- data/lib/simple/http/version.rb +1 -1
- data/lib/simple/http.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3711a46073b07c99d04ff55ed6cd0c1cc44f68f4
|
4
|
+
data.tar.gz: 79522eb93745b870aa0eb41ea28b917cbfdf7a53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 638367ce95b61893708d7bd7ccdca66b9e90fbc8aa450dbbf0b1a1c6abcaf2fe3e78630fd5312e816a464c516772cf98ccf8408c03dc5b0068033230533b4471
|
7
|
+
data.tar.gz: 0713b7e593474e39825f84dab3d854460945d4cf4d2f3fec527c7bdc6c47248290f021eba8e8dc139ea32c19e446ef7a1e8c309ee0c10c2c39a8342ef7b60b06
|
data/lib/simple/http/version.rb
CHANGED
data/lib/simple/http.rb
CHANGED
@@ -97,7 +97,7 @@ class Simple::HTTP
|
|
97
97
|
# raise an error.
|
98
98
|
def http_(method, url, body, headers, max_redirections = 10)
|
99
99
|
if method == :GET && cache && result = cache.read(url)
|
100
|
-
logger.debug "#{method} #{
|
100
|
+
logger.debug "#{method} #{url}: using cached result"
|
101
101
|
return result
|
102
102
|
end
|
103
103
|
|
@@ -120,7 +120,7 @@ class Simple::HTTP
|
|
120
120
|
# execute request
|
121
121
|
started_at = Time.now
|
122
122
|
response = http.request(request)
|
123
|
-
logger.info "#{method} #{
|
123
|
+
logger.info "#{method} #{url}: #{response.body.bytesize} byte, #{"%.3f secs" % (Time.now - started_at)}"
|
124
124
|
|
125
125
|
#
|
126
126
|
# Most of the times Net::HTTP#request returns a response with the :uri
|
@@ -134,9 +134,9 @@ class Simple::HTTP
|
|
134
134
|
result = response.result
|
135
135
|
if cache && method == :GET && expires_in = self.expires_in(response)
|
136
136
|
if response.expires_in == expires_in
|
137
|
-
logger.debug "#{method} #{
|
137
|
+
logger.debug "#{method} #{url}: store in cache, w/expiration of #{expires_in}"
|
138
138
|
else
|
139
|
-
logger.debug "#{method} #{
|
139
|
+
logger.debug "#{method} #{url}: store in cache, w/custom expiration of #{expires_in} (instead #{response.expires_in.inspect})"
|
140
140
|
end
|
141
141
|
cache.write(url, result, expires_in: expires_in)
|
142
142
|
end
|