net-http 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/doc/net-http/examples.rdoc +30 -0
- data/lib/net/http/header.rb +470 -103
- data/lib/net/http/request.rb +27 -5
- data/lib/net/http/requests.rb +296 -24
- data/lib/net/http/response.rb +127 -11
- data/lib/net/http/responses.rb +479 -69
- data/lib/net/http.rb +599 -346
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2201663415fa5809c53f6c1d8a06524739bcee246443e22175aa89cda45c92c
|
4
|
+
data.tar.gz: 971f571f8d9966a09baf43a5117d9f072ae78b890e6cc4991a958081728671c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '086e4def849a69d4ecad94e1a13fe35eee82453f8748be247ea2c133b40ae7d3b419a0f71fa9dcd7efe783d0b725a13d527e287da1ccc406f7daa5700f2ec8e5'
|
7
|
+
data.tar.gz: 47a0f2d46fe8a9bc328241fb0fc90ea1c4285b0e46460998e40650a930bd96743051911e62b790d4502b39a007a5a04e260affe42d584bb73442ab414b51f1e3
|
data/.gitignore
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
Examples here assume that <tt>net/http</tt> has been required
|
2
|
+
(which also requires +uri+):
|
3
|
+
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
Many code examples here use these example websites:
|
7
|
+
|
8
|
+
- https://jsonplaceholder.typicode.com.
|
9
|
+
- http://example.com.
|
10
|
+
|
11
|
+
Some examples also assume these variables:
|
12
|
+
|
13
|
+
uri = URI('https://jsonplaceholder.typicode.com')
|
14
|
+
uri.freeze # Examples may not modify.
|
15
|
+
hostname = uri.hostname # => "jsonplaceholder.typicode.com"
|
16
|
+
port = uri.port # => 443
|
17
|
+
|
18
|
+
So that example requests may be written as:
|
19
|
+
|
20
|
+
Net::HTTP.get(uri)
|
21
|
+
Net::HTTP.get(hostname, '/index.html')
|
22
|
+
Net::HTTP.start(hostname) do |http|
|
23
|
+
http.get('/todos/1')
|
24
|
+
http.get('/todos/2')
|
25
|
+
end
|
26
|
+
|
27
|
+
An example that needs a modified URI first duplicates +uri+, then modifies the duplicate:
|
28
|
+
|
29
|
+
_uri = uri.dup
|
30
|
+
_uri.path = '/todos/1'
|