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

Setting a scheme #56

Closed
hotrush opened this Issue May 3, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@hotrush
Copy link

hotrush commented May 3, 2016

$website = League\Uri\Schemes\Http::createFromString('example.com/asd');
$website = $website->withScheme('http');

throws an exception

RuntimeException [ 0 ]: The URI properties will produce an invalid `League\Uri\Schemes\Http` ~ DOCROOT/vendor/league/uri/src/Schemes/Generic/AbstractUri.php [ 538 ]

Is this a normal behavior?

@nyamsprod

This comment has been minimized.

Copy link
Member

nyamsprod commented May 3, 2016

yes it is, quick explanation.

From an Uri point of view example.com/asd is a path NOT a host and a path. So your $website represents an HTTP URI containing only a path. HTTP Uris can not contain a scheme without an authority. Since $website is only a path and you are trying to add a scheme you get a exception as expected.

@nyamsprod nyamsprod added the question label May 3, 2016

@hotrush

This comment has been minimized.

Copy link

hotrush commented May 3, 2016

Ok, thanks. Can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment