tiny_http_client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -4
  3. data/lib/tiny_http_client.rb +2 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13deb12399bc206c908c3c893c3eb33846098c8f
4
- data.tar.gz: e79cc876a3b0a820b7256e61e6c0fd3e102955dd
3
+ metadata.gz: 4b4c0ce2427cb373cd438537e99d0e4ef28f8ff0
4
+ data.tar.gz: cabe3f18fbd4383b2a3c1d62ea227135e671da6a
5
5
  SHA512:
6
- metadata.gz: 0c865f76a27cb3e6803eafd8f560bdab8e094f2be282ef258d2365acb44dbf7a8d98ff33560cbdbf8f523130b6f429ec3e372358119a831a5317b17aa9e9c76d
7
- data.tar.gz: 694f20daff7ee7ae58b02b73a6cd538391f151eb5604cda737fc27818faa2c971812ebeced83381317c9210292a02f081fd09d8cca99790e72daaefdaf092f82
6
+ metadata.gz: 409b5de968df5b1d56ccd79d60a1356e758559056a4e6669c8527103944d5fad4718e181f6a52d86c7d24b4d5d599e106710ef23791d8509fd0cc00b284d6c86
7
+ data.tar.gz: 659b608f05937c37873ef347f7a1ff82499074ed112933813f9c1745b31b74daecb601f39985398af278e58c8221aa6dfcfc22bd98eba590513a52e5efd3779a
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Tiny HTTP Client
2
2
 
3
- A really simple http client, get content by url:
3
+ A really simple http client:
4
+
5
+ 1. Get content by url
6
+ 2. Follow redirect like your browser did
7
+ 3. Raise error otherwise
8
+
9
+ ## Examples:
4
10
 
5
11
  ```ruby
6
12
 
@@ -8,7 +14,7 @@ html_content = TinyHttpClient.get("http://www.google.com")
8
14
 
9
15
  ```
10
16
 
11
- or, add basic auth
17
+ add basic auth
12
18
 
13
19
  ```ruby
14
20
 
@@ -17,5 +23,3 @@ html_content = TinyHttpClient.get("http://www.google.com") do |req|
17
23
  end
18
24
 
19
25
  ```
20
-
21
- You'll get error when the response is not Net::HTTPSuccess.
@@ -13,6 +13,8 @@ module TinyHttpClient
13
13
  case res = https.request(req)
14
14
  when Net::HTTPSuccess
15
15
  res.body
16
+ when Net::HTTPRedirection
17
+ get(res['location'])
16
18
  else
17
19
  res.error!
18
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_http_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li