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

New Addressable::URI throws exception on #scheme= #52

Closed
jordansissel opened this issue Jan 5, 2012 · 2 comments
Closed

New Addressable::URI throws exception on #scheme= #52

jordansissel opened this issue Jan 5, 2012 · 2 comments

Comments

@jordansissel
Copy link

Howdy! Thanks for the code. Found a bug I think.

    >> a = Addressable::URI.new
    => #<Addressable::URI:0x1226874 URI:>
    >> a.scheme = "http"
    Addressable::URI::InvalidURIError: Absolute URI missing hierarchical segment: 'http:'

If I set a host first, this works:

>> a.host = "foo"
=> "foo"
>> a.scheme = "http"
=> "http"
@sporkmonger
Copy link
Owner

It's not really a bug. Addressable needs to validate the URI after every modification to it. 'http:' is not a valid URI. Rather than create the URI piece-wise, use the constructor and hash notation:

a = Addressable::URI.new(
  :scheme => "http",
  :host => "foo"
)

@jordansissel
Copy link
Author

Ahha, ok this makes sense.

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