Cover all aspects of url_for in the guides
Using url_for with named routes is pretty well covered.
# "/myapp/index.html?foo=bar" if application is deployed under "/myapp"
$c->url_for('/index.html')->query(foo => 'bar');
But how it can make relative paths absolute, or how the returned Mojo::URL object can be modified is not covered very well yet.
I suppose this could also cover why $c->req->url is relative and $c->req->url->to_abs absolute.
For starters i've added some more examples to the reference docs. But something in the guides would be nice. https://github.com/kraih/mojo/commit/0c513be6ef423e5cb4ab4a16448d1451e01d39ac
This should also clarify some aspects of links generated relative to the base path. See for example the confusion here https://irclog.perlgeek.de/mojo/2017-12-13#i_15572052 about some of the tag helpers where %= stylesheet '/foo.css' becomes /path/to/foo.css
I was surprised to discover the following behaviour, that placeholder values passed to url_for are expected to already be percent encoded. I did not see that mentioned anywhere in the documentation.
# /example/foo%3Fbar
$self->url_for('example', {'placeholder' => 'foo?bar'}); # Seems to work, but...
# /example/foo%C2%BAr
$self->url_for('example', {'placeholder' => 'foo%bar'}); # Bad
# /example/foo%3Fbar
$self->url_for('example', {'placeholder' => url_escape('foo?bar'}));
# /example/foo%25bar
$self->url_for('example', {'placeholder' => url_escape('foo%bar')});