Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP.get eats keyword arguments #1142

Open
ericphanson opened this issue Jan 29, 2024 · 1 comment
Open

HTTP.get eats keyword arguments #1142

ericphanson opened this issue Jan 29, 2024 · 1 comment

Comments

@ericphanson
Copy link

On HTTP.jl v1.10.1,

julia> HTTP.get("http://localhost:31337"; nonsense=1)
ERROR: HTTP.ConnectError for url = `http://localhost:31337`: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
 [1] getconnection(::Type{…}, host::SubString{…}, port::SubString{…}; keepalive::Bool, readtimeout::Int64, kw::@Kwargs{})

This should be a MethodError or similiar, like

julia> f(x) = 1
f (generic function with 1 method)

julia> f(1; nonsense="abc")
ERROR: MethodError: no method matching f(::Int64; nonsense::String)

Closest candidates are:
  f(::Any) got unsupported keyword argument "nonsense"
   @ Main REPL[12]:1

This issue makes it really hard to figure out when you're using the wrong keyword argument, e.g. JuliaCloud/AWS.jl#666 (comment).

@quinnj
Copy link
Member

quinnj commented Jan 31, 2024

Duplicate of (the admittedly too minimal) #1024. I have some thoughts on this, but it's made tricky because of the @client macro ability for external layers to be added that may want to allow passing their own keyword arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants