Skip to content

Commit 7910117

Browse files
committed
add colon to origin string in url object
make protocol available in url object
1 parent 167baa3 commit 7910117

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/page.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ var Page = function( page_path, options ){
222222
if( res.headers['content-encoding'] == 'gzip' || res.headers['content-encoding'] == 'deflate' ) {
223223
response_stream = res.pipe( new zlib.Unzip() );
224224
}
225-
225+
226226
response_stream.on( 'data', function onData( chunk ){
227227
data += chunk;
228228
});
@@ -267,8 +267,8 @@ var Page = function( page_path, options ){
267267
// generate url data to be served in context
268268
var href = req.protocol +'://'+ req.get('host') + req.url;
269269
var url_data = url.parse( href, true );
270-
url_data = _.pick( url_data, 'host', 'port', 'hostname', 'hash', 'search', 'query', 'pathname', 'path', 'href' );
271-
url_data.origin = req.protocol +'//'+ url_data.host;
270+
url_data = _.pick( url_data, 'host', 'port', 'hostname', 'hash', 'search', 'query', 'pathname', 'path', 'href', 'protocol' );
271+
url_data.origin = url_data.protocol +'//'+ url_data.host;
272272

273273
var context = {
274274
url: url_data,
@@ -353,7 +353,7 @@ var Page = function( page_path, options ){
353353
router.routes.get = _( router.routes.get ).reject( function( current_route ){
354354
return current_route.path === page.route;
355355
});
356-
356+
357357
};
358358

359359
this.createRoute();
@@ -368,4 +368,4 @@ util.inherits( Page, EventEmitter );
368368

369369
Page.layouts = {};
370370

371-
module.exports = Page;
371+
module.exports = Page;

0 commit comments

Comments
 (0)