mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-22 00:05:57 -05:00
starting notes on the next minor version
This commit is contained in:
parent
978a5ffa22
commit
b67c5d53e0
38
doc/release_notes/0_9_0.md
Normal file
38
doc/release_notes/0_9_0.md
Normal file
@ -0,0 +1,38 @@
|
||||
# 0.9.0
|
||||
|
||||
## Features
|
||||
|
||||
### Multiple requests with specific options
|
||||
|
||||
You can now pass a third element to the "request element" of an array to `.request`.
|
||||
|
||||
```ruby
|
||||
requests = [
|
||||
[:post, "https://url/post", { form: { foo: "bar" } }],
|
||||
[:post, "https://url/post", { form: { foo: "bar2" } }]
|
||||
]
|
||||
HTTPX.request(requests)
|
||||
# or, if you want to pass options common to all requests
|
||||
HTTPX.request(requests, max_concurrent_requests: 1)
|
||||
```
|
||||
|
||||
|
||||
### HTTPX::Session#build_request
|
||||
|
||||
`HTTPX::Session::build_request` is now public API from a session. You can now build requests before you send them. These request objects are still considered somewhat "internal", so consider them immutable and **do not rely on its API**. Just pass them forward.
|
||||
|
||||
Note: this API is only available for instantiated session, so there is no `HTTPX.build_request`.
|
||||
|
||||
|
||||
```ruby
|
||||
|
||||
HTTPX.wrap do |http|
|
||||
requests = [
|
||||
http.build_request(:post, "https://url/post", { form: { foo: "bar" } }),
|
||||
http.build_request(:post, "https://url/post", { form: { foo: "bar2" } })
|
||||
]
|
||||
http.request(requests)
|
||||
# or, if you want to pass options common to all requests
|
||||
http.request(requests, max_concurrent_requests: 1)
|
||||
end
|
||||
```
|
||||
@ -6,9 +6,9 @@ include HTTPX
|
||||
URLS = %w[http://nghttp2.org/httpbin/post] * 102
|
||||
|
||||
$HTTPX_DEBUG = true
|
||||
client = Client.new
|
||||
requests = URLS.map { |url| client.request(:post, url, json: {"bang" => "bang"}) }
|
||||
responses = client.send(*requests)
|
||||
client = Session.new
|
||||
requests = URLS.map { |url| client.build_request(:post, url, json: {"bang" => "bang"}) }
|
||||
responses = client.request(*requests)
|
||||
|
||||
responses.each do |res|
|
||||
puts "status: #{res.status}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user