Numerical config values are accepted but not used
This is another case where the API is permissive, but incorrect input leads to silent failure/surprising behavior.
With a float set as timeout:
[6] pry(main)> HTTPX.with(:timeout => {request_timeout: 0.1}).get("https://httpbin.org") => #<HTTPX::ErrorResponse:0x0000ffff64ef2950 @error=#<HTTPX::RequestTimeoutError: Timed out after 0.1 seconds>
With a string timeout (e.g. read directly from an environment variable)
HTTPX.with(:timeout => {request_timeout: "0.1"}).get("https://httpbin.org")
# ...
# hangs because the timeout hasn't been applied
I would expect the library to either:
- Strictly convert the config to float using
Float(). Works as expected even though I have been loose with my types, yet still throws an error if I pass something weird like a symbol. - Raise
ArgumentErroras the config has the wrong type.