Hacker News new | past | comments | ask | show | jobs | submit login

The question was how to build a URL, not how to send off a request to it. The answer sends off a request and then inspects the response to see what URL was used. If you wanted to send off the request, inspecting the URL on the result is probably not useful. If you didn't want to send off the request, doing it this was is wasteful or even harmful.



Yes, but unless the answer was edited before the link to HN was posted, the user specifically said you should only do it if you _really_ intend to make a request, not just generate a url. It is conceivable you'd want to log the request or something and hence reference the url after the request call. Yeah, it is a bad answer to the question as stated, but it has a logic to it considering what might be the real motivation behind the question.

EDIT: Apparently the answer was edited by another user just recently making the clarification.


Interesting, thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: