http_mini 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +5 -2
- data/lib/http_mini.rb +7 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f93b2064b5592e3a408d787a8d798c743887657f
|
4
|
+
data.tar.gz: 2d60a389747a0cb5d16fddeda6a5b5fed41cb075
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d73bca6a2f198863beb89323b1208c531a1fd3e3292f83898f6cd3d9ade94bc3fd1352e82e09232118a85504105a6b7dbddfe84867964240509aa7a48c2841
|
7
|
+
data.tar.gz: 26362c645b4a158fdac79fb53cad10caf260def72cde89d9500589cf7f01154a5b729f95b28d222fa77120a337d5837a5dd06196633674ca6bdfcafc55baddad
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -34,6 +34,9 @@ a one liner to ping or get the response from a web server.
|
|
34
34
|
# Set http headers
|
35
35
|
puts HttpMini.new('http://www.google.com', headers: {'user-agent' => 'Fancy UserAgent Name'}).head.code
|
36
36
|
|
37
|
+
# Basic auth
|
38
|
+
puts HttpMini.new('http://foo:bar@www.acme.com').head.code
|
39
|
+
|
37
40
|
## HTTP verbs Support
|
38
41
|
|
39
42
|
* HEAD
|
@@ -46,8 +49,8 @@ a one liner to ping or get the response from a web server.
|
|
46
49
|
## Request options
|
47
50
|
|
48
51
|
* `:headers` - http headers, defaults to {}
|
49
|
-
* `:
|
50
|
-
* `:
|
52
|
+
* `:timeout` - number of seconds to wait for the connection to open, number of seconds to wait for one block to be read
|
53
|
+
* `:ignore_error` - ignore errors on poke, defaults to `true`
|
51
54
|
|
52
55
|
## Author
|
53
56
|
|
data/lib/http_mini.rb
CHANGED
@@ -8,7 +8,7 @@ class HttpMini
|
|
8
8
|
IGNORE_ERROR = true
|
9
9
|
|
10
10
|
def self.VERSION
|
11
|
-
'0.3.
|
11
|
+
'0.3.1'
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(uri, opts = {})
|
@@ -77,7 +77,7 @@ class HttpMini
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def request(req, data=nil)
|
80
|
-
http.start { |http| http.request(req, data) }
|
80
|
+
http.start { |http| http.request(auth(req), data) }
|
81
81
|
end
|
82
82
|
|
83
83
|
def http
|
@@ -87,6 +87,11 @@ class HttpMini
|
|
87
87
|
http
|
88
88
|
end
|
89
89
|
|
90
|
+
def auth(req)
|
91
|
+
req.basic_auth(@uri.user, @uri.password) if @uri.user
|
92
|
+
req
|
93
|
+
end
|
94
|
+
|
90
95
|
def headers
|
91
96
|
opts[:headers] || {}
|
92
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_mini
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerome Touffe-Blin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|