j2labs / brubeck

Asynchronous web and messaging
http://brubeck.io
511 stars 66 forks source link

Add host property to Request #110

Open lkraider opened 11 years ago

lkraider commented 11 years ago

An extra property to get only the url scheme e netloc parts from the request url, useful when mapping to other urls within the same domain in the handlers.

lkraider commented 11 years ago

I don't think all handlers will use this property, so you'll be trading access cost for some handlers vs initialization cost for all handlers. It could be memoized, but I don't see much need to do so.

sethmurphy commented 11 years ago

I agree with Paul, we should be very careful adding anything that touches every request. Ben's suggestion seems like the perfect compromise, adding a function in the request module to parse the header as needed and leaving the request class alone. There was a thread on this in the group a while back: https://groups.google.com/forum/?fromgroups=#!topic/brubeck-dev/QZNIBzFgKcs

On Mon, Apr 22, 2013 at 3:13 PM, Paul Eipper notifications@github.comwrote:

I don't think all handlers will use this property, so you'll be trading access cost for some handlers vs initialization cost for all handlers. It could be memoized, but I don't see much need to do so.

— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/brubeck/pull/110#issuecomment-16815013 .