HoneyryderChuck / httpx

(Mirror) An HTTP client library for ruby
https://gitlab.com/os85/httpx
Apache License 2.0
192 stars 10 forks source link

Make Requests - Outdated Wiki Example #27

Closed Aubermean closed 11 months ago

Aubermean commented 11 months ago

requests = [
  ["GET", "https://nghttp2.org/httpbin/get"],
  ["POST", "https://nghttp2.org/httpbin/post", { body: "bla" }]
]

responses = HTTPX.request(*requests)
HTTPX::Error: invalid URI: POST
from /Users/bandit/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/httpx-4809e1d0d05f/lib/httpx/request.rb:57:in `initialize'

https://honeyryderchuck.gitlab.io/httpx/wiki/Make-Requests

HoneyryderChuck commented 11 months ago

thx for the report. that's actually a bug, that example should be supported. I noticed it last week as well, planning to fix it before next minor release.

HoneyryderChuck commented 11 months ago

In the end it wasn't a bug, but a doc error, like you hinted. the * is not required:

requests = [
  ["GET", "https://nghttp2.org/httpbin/get"],
  ["POST", "https://nghttp2.org/httpbin/post", { body: "bla" }]
]

responses = HTTPX.request(requests)

Updated the docs already.