async-http 0.73.0 → 0.74.0

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: 01cf4d909911a28f4f386982504e5865d9053210af1cb121a4acc8e0812a63bd
4
- data.tar.gz: 20b913990be812792c72f5e68649ee8084310112287e316c438c6a220cee9982
3
+ metadata.gz: 5a21c7008b5509bd6f8bdffd7dad87a7679bdc9f32584cc71fa2b468518cd57c
4
+ data.tar.gz: 2836fc0ef066dfeb60240dce08dd88c07201250b948cfb04617ab52e9d20371c
5
5
  SHA512:
6
- metadata.gz: 6b1eefc4c6f0d1a631c1b6f0365ae36a7fe4067e1b372f334473b99f379f0755d29d53a5a04183f5eef46a9c0cf6504a2a56b7c5741757700b44d5c2283fb129
7
- data.tar.gz: 1ed32dc7b17b30ddd2d842e688e89df28a0cc51a0610398ea567191c6158c5adde2ebdd337035450fca499b0c312e2d9b3bed616f9cf1058c1d136bbdd10acd4
6
+ metadata.gz: c249984efd9030c199c6b1199dfb4ededdd25a7db33e5156c0ecec2a5d883d703bc976216da13c33426d4814514676f80296687293c53cb4ddc33f44ff4f38a3
7
+ data.tar.gz: f707e1908dc79b1e16f2be6546f1781003f4d88e21307fd5172d27198b61a08f87e350a43f784445a761cda89cb674669b552e77ef1e9de4cfaeb4095040ffa9
checksums.yaml.gz.sig CHANGED
Binary file
@@ -39,14 +39,14 @@ module Async
39
39
  # @parameter url [String] The URL to request, e.g. `https://www.codeotaku.com`.
40
40
  # @parameter headers [Hash | Protocol::HTTP::Headers] The headers to send with the request.
41
41
  # @parameter body [String | Protocol::HTTP::Body] The body to send with the request.
42
- def call(method, url, headers = nil, body = nil, &block)
42
+ def call(verb, url, *arguments, **options, &block)
43
43
  endpoint = Endpoint[url]
44
44
  client = self.client_for(endpoint)
45
45
 
46
- body = Body::Buffered.wrap(body)
47
- headers = ::Protocol::HTTP::Headers[headers]
46
+ options[:authority] ||= endpoint.authority
47
+ options[:scheme] ||= endpoint.scheme
48
48
 
49
- request = ::Protocol::HTTP::Request.new(endpoint.scheme, endpoint.authority, method, endpoint.path, nil, headers, body)
49
+ request = ::Protocol::HTTP::Request[verb, endpoint.path, *arguments, **options]
50
50
 
51
51
  response = client.call(request)
52
52
 
@@ -68,8 +68,8 @@ module Async
68
68
  end
69
69
 
70
70
  ::Protocol::HTTP::Methods.each do |name, verb|
71
- define_method(verb.downcase) do |url, headers = nil, body = nil, &block|
72
- self.call(verb, url, headers, body, &block)
71
+ define_method(verb.downcase) do |url, *arguments, **options, &block|
72
+ self.call(verb, url, *arguments, **options, &block)
73
73
  end
74
74
  end
75
75
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module HTTP
8
- VERSION = "0.73.0"
8
+ VERSION = "0.74.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -12,6 +12,18 @@ Please see the [project documentation](https://socketry.github.io/async-http/) f
12
12
 
13
13
  - [Testing](https://socketry.github.io/async-http/guides/testing/index) - This guide explains how to use `Async::HTTP` clients and servers in your tests.
14
14
 
15
+ ## Releases
16
+
17
+ Please see the [project releases](https://socketry.github.io/async-http/releases/index) for all releases.
18
+
19
+ ### v0.74.0
20
+
21
+ - [`Async::HTTP::Internet` accepts keyword arguments](https://socketry.github.io/async-http/releases/index#async::http::internet-accepts-keyword-arguments)
22
+
23
+ ### v0.73.0
24
+
25
+ - [Update support for `interim_response`](https://socketry.github.io/async-http/releases/index#update-support-for-interim_response)
26
+
15
27
  ## See Also
16
28
 
17
29
  - [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
data/releases.md ADDED
@@ -0,0 +1,51 @@
1
+ # Releases
2
+
3
+ ## v0.74.0
4
+
5
+ ### `Async::HTTP::Internet` accepts keyword arguments
6
+
7
+ `Async::HTTP::Internet` now accepts keyword arguments for making a request, e.g.
8
+
9
+ ``` ruby
10
+ internet = Async::HTTP::Internet.instance
11
+
12
+ # This will let you override the authority (HTTP/1.1 host header, HTTP/2 :authority header):
13
+ internet.get("https://proxy.local", authority: "example.com")
14
+
15
+ # This will let you override the scheme:
16
+ internet.get("https://example.com", scheme: "http")
17
+ ```
18
+
19
+ ## v0.73.0
20
+
21
+ ### Update support for `interim_response`
22
+
23
+ `Protocol::HTTP::Request` now supports an `interim_response` callback, which will be called with the interim response status and headers. This works on both the client and the server:
24
+
25
+ ``` ruby
26
+ # Server side:
27
+ def call(request)
28
+ if request.headers['expect'].include?('100-continue')
29
+ request.send_interim_response(100)
30
+ end
31
+
32
+ # ...
33
+ end
34
+
35
+ # Client side:
36
+ body = Async::HTTP::Body::Writable.new
37
+
38
+ interim_repsonse = proc do |status, headers|
39
+ if status == 100
40
+ # Continue sending the body...
41
+ body.write("Hello, world!")
42
+ body.close
43
+ end
44
+ end
45
+
46
+ Async::HTTP::Internet.instance.post("https://example.com", body, interim_response: interim_response) do |response|
47
+ unless response.success?
48
+ body.close
49
+ end
50
+ end
51
+ ```
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.73.0
4
+ version: 0.74.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -224,6 +224,7 @@ files:
224
224
  - lib/async/http/version.rb
225
225
  - license.md
226
226
  - readme.md
227
+ - releases.md
227
228
  homepage: https://github.com/socketry/async-http
228
229
  licenses:
229
230
  - MIT
metadata.gz.sig CHANGED
Binary file