
Issue #19915 has been updated by postmodern (Hal Brodigan). I would expect either for unused options to raise an ArgumentError, or for `user:` and `password:` to be accepted and used. Since `URI::HTTP.build` is actually accepting a Hash [1], this makes it harder to validate the given Hash keys and raise an ArgumentError on unused keys. [1]: https://github.com/ruby/uri/blob/f4999b61daa40f2c99fdc7159e2c85c036b22c67/li... ---------------------------------------- Feature #19915: URI::HTTP.build accepts user: and password: keyboard arguments, but do not populate #user or #password https://bugs.ruby-lang.org/issues/19915#change-104857 * Author: postmodern (Hal Brodigan) * Status: Open * Priority: Normal ---------------------------------------- I noticed that `URI::HTTP.build` accepts the `user:` and `password:` keyword arguments, but does not actually set the `user` or `password` attributes of the built URI object. It does however correctly accept a `userinfo:` keyword argument. ## Steps To Reproduce ```ruby uri = URI::HTTP.build(user: 'bob', password: 'secret', host: 'example.com', path: '/foo') uri.user uri.password uri.to_s ``` ### Expected Results ```ruby uri.user # => "bob" uri.password # => "secret" uri.to_s # => "http://bob:secret@example.com/foo" ``` ### Actual Results ```ruby uri.user # => nil uri.password # => nil uri.to_s # => "http://example.com/foo" ``` -- https://bugs.ruby-lang.org/