partial.js logo
Latest version
v1.3.1 (RC2)

Request.prototype


Request prototype is available in each node.js / partial.js script. This prototype is defined in Framework (index.js).

Properties


request.data {Object}request.flags {String Array}request.host {String}request.ip {String}request.isAuthorized {Boolean}request.isProxy {Boolean}request.isSecure {Boolean}request.path {String Array}request.prefix {String}request.session {Object}request.subdomain {String Array}request.uri {URI}request.user {Object}request.xhr {Boolean}
request.data;
return Object;

Current request data (req.data.get = {}, req.data.post = {}, req.data.files = [])

request.flags;Default: []
return String Array;

Current request flags.

request.host;
return String;

Current request host.

request.ip;
return String;

Current request IP.

request.isAuthorized;Default: false
return Boolean;

Is authorized? (framework.onAuthorization)

request.isProxy;Default: false
return Boolean;

Is proxy request?

request.isSecure;Default: false
return Boolean;

Is secured request?

request.path;
return String Array;

Current relative URL path.

request.prefix;Default: ''
return String;

Current prefix.

request.session;Default: null
return Object;

Session object.

request.subdomain;Default: []
return String Array;

Current request subdomain.

request.uri;
return URI;

Current URI object.

request.user;Default: null
return Object;

User object.

request.xhr;Default: false
return Boolean;

Is XHR request?

Methods


Request.prototype.authorization()Request.prototype.clear()Request.prototype.cookie(name)Request.prototype.hostname([path])
Request.prototype.authorization();Default: { user: '', password: '' }
return Object;

Read authorization data from the request. Method return { name: 'username', password: 'password' } - if it contains the request.

Request.prototype.clear();
return Request;

Clear uploaded files. This function is executed automatically.

Request.prototype.cookie(name);Default: ''
return String;

Read value from cookie. For write cookies read Response.prototype.

Request.prototype.hostname([path]);
return String;

Get hostname from URL address.