async-http 0.24.1 → 0.24.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5a6e99912be72d417e22040dae54a5a71df384f1e49175397f54d79646e5693
4
- data.tar.gz: 9799c54a6ee30585cbfe1f6bd5c405daf5e9b07087f450173043e7bcd12e8ef7
3
+ metadata.gz: 544832b67f4090c760bfbc3e583d9f63d0300f1add25197c76fd374277e2490f
4
+ data.tar.gz: a7d9db41872b45d47575d864416e3be669f0b2cac6555574b3f94d9d322313c0
5
5
  SHA512:
6
- metadata.gz: ffd4ab0414e6f53b54af56c9cddcb91e223cb0608103db87f912c446c21ac64b9d770dd54e857ee9121ddfe72aa941d3b41df116229857f2a10ddbc90c598bca
7
- data.tar.gz: '0622083f714c342a79d56a0f800e8b2eb92390b1f120f582e4c06ee2ca593828408a157c8d412c4a21ccdde5460642422cc9145b06e490dedea2f37b223829ca'
6
+ metadata.gz: 5ff96006418add5ca4f1c79f806134795f7387ead61b88e2f3534a66a1fc2584cd8667af5389baf427536060780e39464b6987224a4169a292d2abf0f9905ffa
7
+ data.tar.gz: 7b658324c3c6ee42a3c849e2953c6157686abef1b6efe8a7cd439c840a33bb7da04e9f28897a8459726d8a57eca158ce07d6d6e0b2d93b270fa885c7df16cbf5
data/README.md CHANGED
@@ -37,12 +37,13 @@ require 'async/http/server'
37
37
  require 'async/http/client'
38
38
  require 'async/reactor'
39
39
  require 'async/http/url_endpoint'
40
+ require 'async/http/response'
40
41
 
41
42
  endpoint = Async::HTTP::URLEndpoint.parse('http://127.0.0.1:9294', reuse_port: true)
42
43
 
43
44
  class Server < Async::HTTP::Server
44
45
  def handle_request(request, peer, address)
45
- [200, {}, ["Hello World"]]
46
+ Async::HTTP::Response[200, {}, ["Hello World"]]
46
47
  end
47
48
  end
48
49
 
@@ -43,14 +43,12 @@ module Async
43
43
  def call(request, *)
44
44
  response = super
45
45
 
46
+ # TODO use http-accept and sort by priority
46
47
  if !response.body.empty? and accept_encoding = request.headers['accept-encoding']
47
48
  if content_type = response.headers['content-type'] and @content_types.match?(content_type)
48
- # TODO use http-accept and sort by priority
49
- encodings = accept_encoding.split(/\s*,\s*/)
50
-
51
49
  body = response.body
52
50
 
53
- encodings.each do |name|
51
+ accept_encoding.each do |name|
54
52
  if wrapper = @wrappers[name]
55
53
  response.headers['content-encoding'] = name
56
54
 
@@ -46,8 +46,20 @@ module Async
46
46
  end
47
47
 
48
48
  module Okay
49
- def self.call
50
- Response.local(200, {}, [])
49
+ def self.close
50
+ end
51
+
52
+ def self.call(request, *)
53
+ Response[200, {}, []]
54
+ end
55
+ end
56
+
57
+ module HelloWorld
58
+ def self.close
59
+ end
60
+
61
+ def self.call(request, *)
62
+ Response[200, {'content-type' => 'text/plain'}, ["Hello World!"]]
51
63
  end
52
64
  end
53
65
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.24.1"
23
+ VERSION = "0.24.2"
24
24
  end
25
25
  end
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.24.1
4
+ version: 0.24.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async