async-http 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/lib/async/http/client.rb +16 -2
- data/lib/async/http/protocol/http11.rb +1 -1
- data/lib/async/http/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc55d86c67dae639bd404625643fce45b95885fb
|
4
|
+
data.tar.gz: 917e46e388854d5642034d1b78e09eff10cc7c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20f7d3b7bf4306098022cdbe6e4bec53de2d31e5db95ea527a90de0dbe68d74334215082d3354550ff9c0ac6b06cc534728e2d1d762938b358d458a681fd1a57
|
7
|
+
data.tar.gz: 7b8790c819657db9d9dd942ffd3a59ffda40647f6c577ece05ffa678112df2ab8a8edd1a37ddebf4b995f7f2f365cfad1007748cf5d7c1d957e6a40a28414ec7
|
data/README.md
CHANGED
@@ -36,16 +36,18 @@ require 'async/http/server'
|
|
36
36
|
require 'async/http/client'
|
37
37
|
require 'async/reactor'
|
38
38
|
|
39
|
-
|
39
|
+
endpoints = [
|
40
40
|
Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true)
|
41
41
|
]
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
class Server < Async::HTTP::Server
|
44
|
+
def handle_request(request, peer, address)
|
45
|
+
[200, {}, ["Hello World"]]
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
|
-
server =
|
48
|
-
client = Async::HTTP::Client.new(
|
49
|
+
server = Server.new(endpoints)
|
50
|
+
client = Async::HTTP::Client.new(endpoints)
|
49
51
|
|
50
52
|
Async::Reactor.run do |task|
|
51
53
|
server_task = task.async do
|
data/lib/async/http/client.rb
CHANGED
@@ -32,10 +32,24 @@ module Async
|
|
32
32
|
end
|
33
33
|
|
34
34
|
GET = 'GET'.freeze
|
35
|
+
HEAD = 'HEAD'.freeze
|
36
|
+
POST = 'POST'.freeze
|
35
37
|
|
36
|
-
def get(path,
|
38
|
+
def get(path, *args)
|
37
39
|
connect do |protocol|
|
38
|
-
protocol.send_request(GET, path,
|
40
|
+
protocol.send_request(GET, path, *args)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def head(path, *args)
|
45
|
+
connect do |protocol|
|
46
|
+
protocol.send_request(HEAD, path, *args)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def post(path, *args)
|
51
|
+
connect do |protocol|
|
52
|
+
protocol.send_request(POST, path, *args)
|
39
53
|
end
|
40
54
|
end
|
41
55
|
|
data/lib/async/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.6.
|
141
|
+
rubygems_version: 2.6.12
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: ''
|